CreateAuctionView.m 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. //
  2. // CreateAuctionView.m
  3. // BuguLive
  4. //
  5. // Created by 王珂 on 16/10/14.
  6. // Copyright © 2016年 xfg. All rights reserved.
  7. //
  8. #import "CreateAuctionView.h"
  9. @interface CreateAuctionView()
  10. @property (nonatomic, strong) UILabel * label1; //画线label
  11. @property (nonatomic, strong) UILabel * label2; //画线label
  12. @property (nonatomic, strong) UILabel * virtulLabel; //虚拟竞拍
  13. @property (nonatomic, strong) UILabel * realLabel; //实物竞拍
  14. @property (nonatomic, strong) UIButton * virtulButton; //虚拟竞拍按钮
  15. @property (nonatomic, strong) UIButton * realButton; //实物竞拍按钮
  16. @property (nonatomic, strong) UIButton * cancelButton; //取消按钮
  17. @property (nonatomic, strong) UIImageView * virtulView; //虚拟竞拍图片
  18. @property (nonatomic, strong) UIImageView * realView; //实物竞拍图片
  19. @end
  20. @implementation CreateAuctionView
  21. - (instancetype)initWithFrame:(CGRect)frame
  22. {
  23. if (self=[super initWithFrame:frame])
  24. {
  25. _label1=[[UILabel alloc] init];
  26. [self addSubview:_label1];
  27. _label2=[[UILabel alloc] init];
  28. [self addSubview:_label2];
  29. _virtulLabel=[[UILabel alloc] init];
  30. [self addSubview:_virtulLabel];
  31. _realLabel=[[UILabel alloc] init];
  32. [self addSubview:_realLabel];
  33. _virtulButton = [UIButton buttonWithType:UIButtonTypeCustom];
  34. [self addSubview:_virtulButton];
  35. _realButton = [UIButton buttonWithType:UIButtonTypeCustom];
  36. [self addSubview:_realButton];
  37. _cancelButton = [UIButton buttonWithType:UIButtonTypeCustom];
  38. [self addSubview:_cancelButton];
  39. _virtulView = [[UIImageView alloc] init];
  40. [self addSubview:_virtulView];
  41. _realView =[[UIImageView alloc] init];
  42. [self addSubview:_realView];
  43. [_virtulView setImage:[UIImage imageNamed:@"ac_virtual_goods"]];
  44. _virtulLabel.textColor = kAppGrayColor1;
  45. _virtulLabel.text = ASLocalizedString(@"虚拟竞拍");
  46. _virtulLabel.font = kAppMiddleTextFont;
  47. _label1.alpha = 0.5;
  48. _label1.backgroundColor = kAppGrayColor4;
  49. [_realView setImage:[UIImage imageNamed:@"ac_real_goods"]];
  50. _realLabel.text = ASLocalizedString(@"实物竞拍");
  51. _realLabel.textColor = kAppGrayColor1;
  52. _realLabel.font = kAppMiddleTextFont;
  53. _label2.alpha = 0.5;
  54. _label2.backgroundColor = kAppGrayColor4;
  55. [_cancelButton setTitle:ASLocalizedString(@"取消")forState:UIControlStateNormal];
  56. _cancelButton.titleLabel.font = kAppMiddleTextFont;
  57. _cancelButton.tag = 303;
  58. _cancelButton.backgroundColor = kAppMainColor;
  59. _cancelButton.layer.cornerRadius = 18;
  60. _cancelButton.layer.masksToBounds= YES;
  61. [_cancelButton addTarget:self action:@selector(chooseButton:) forControlEvents:UIControlEventTouchUpInside];
  62. }
  63. return self;
  64. }
  65. - (void)createVieWith:(NSInteger)i andNumber:(NSInteger)j
  66. {
  67. //i为虚拟,j为实物
  68. if (i==1 && j==1)
  69. {
  70. [self creatVirtulView];
  71. _realView.frame = CGRectMake((kScreenW-108)/2, 94, 34, 38);
  72. _realLabel.frame = CGRectMake(CGRectGetMaxX(_realView.frame)+9, 98, 65, 30);
  73. _realButton.frame = CGRectMake(0, 76, kScreenW, 75);
  74. _realButton.tag = 302;
  75. [_realButton addTarget:self action:@selector(chooseButton:) forControlEvents:UIControlEventTouchUpInside];
  76. _label2.frame = CGRectMake(0, 151, kScreenW, 0.5);
  77. _cancelButton.frame = CGRectMake(5, 159, kScreenW-10, 36);
  78. }
  79. else if (j==0 && i==1) //只支持虚拟竞拍
  80. {
  81. [self creatVirtulView];
  82. _cancelButton.frame = CGRectMake(5, 83, kScreenW-10, 36);
  83. }
  84. else if (i==0 && j==1) //只支持实物竞拍
  85. {
  86. _realView.frame = CGRectMake((kScreenW-108)/2, 18, 34, 38);
  87. _realLabel.frame = CGRectMake(CGRectGetMaxX(_realView.frame)+9, 22, 65, 30);
  88. _realButton.frame = CGRectMake(0, 0, kScreenW, 75);
  89. _realButton.tag = 302;
  90. [_realButton addTarget:self action:@selector(chooseButton:) forControlEvents:UIControlEventTouchUpInside];
  91. _label1.frame = CGRectMake(0, 75, kScreenW, 0.5);
  92. }
  93. }
  94. - (void)chooseButton:(UIButton *)button
  95. {
  96. if (_delegate&&[_delegate respondsToSelector:@selector(chooseButton:)])
  97. {
  98. [_delegate chooseButton:button];
  99. }
  100. }
  101. - (void)creatVirtulView
  102. {
  103. _virtulView.frame = CGRectMake((kScreenW-108)/2, 25, 34, 25);
  104. _virtulLabel.frame = CGRectMake(CGRectGetMaxX(_virtulView.frame)+9, 22, 65, 30);
  105. _virtulButton.frame = CGRectMake(0, 0, kScreenW, 75);
  106. _virtulButton.tag = 301;
  107. [_virtulButton addTarget:self action:@selector(chooseButton:) forControlEvents:UIControlEventTouchUpInside];
  108. _label1.frame = CGRectMake(0, 75, kScreenW, 0.5);
  109. }
  110. @end