Commit 02b5da65b26fb047dcb1255f00e0c2fe943ad7c4

Authored by zhangxiaowen
1 parent a6599e03

no message

CNLiveQrCodeModule/Classes/View/CNLiveMyQrCodeView.m
@@ -22,6 +22,8 @@ @@ -22,6 +22,8 @@
22 @property (nonatomic, strong) UIImageView *header; 22 @property (nonatomic, strong) UIImageView *header;
23 @property (nonatomic, strong) UILabel *name; 23 @property (nonatomic, strong) UILabel *name;
24 @property (nonatomic, strong) UILabel *address; 24 @property (nonatomic, strong) UILabel *address;
  25 +@property (nonatomic, strong) UIButton *reset;
  26 +
25 @property (nonatomic, strong) UIImageView *qrCode; 27 @property (nonatomic, strong) UIImageView *qrCode;
26 28
27 @property (nonatomic, strong) UILabel *friends; 29 @property (nonatomic, strong) UILabel *friends;
@@ -52,10 +54,14 @@ static const CGFloat timeValue = 1.5; @@ -52,10 +54,14 @@ static const CGFloat timeValue = 1.5;
52 54
53 - (void)createSubViews { 55 - (void)createSubViews {
54 [self addSubview:self.header]; 56 [self addSubview:self.header];
  57 + [self addSubview:self.reset];
  58 +
55 [self addSubview:self.name]; 59 [self addSubview:self.name];
56 [self addSubview:self.address]; 60 [self addSubview:self.address];
  61 +
57 [self addSubview:self.qrCode]; 62 [self addSubview:self.qrCode];
58 [self addSubview:self.friends]; 63 [self addSubview:self.friends];
  64 +
59 [_header mas_makeConstraints:^(MASConstraintMaker *make) { 65 [_header mas_makeConstraints:^(MASConstraintMaker *make) {
60 make.left.equalTo(self.mas_left).with.offset(margin); 66 make.left.equalTo(self.mas_left).with.offset(margin);
61 make.top.equalTo(self.mas_top).with.offset(margin); 67 make.top.equalTo(self.mas_top).with.offset(margin);
@@ -63,10 +69,17 @@ static const CGFloat timeValue = 1.5; @@ -63,10 +69,17 @@ static const CGFloat timeValue = 1.5;
63 69
64 }]; 70 }];
65 71
  72 + [_reset mas_makeConstraints:^(MASConstraintMaker *make) {
  73 + make.centerY.equalTo(self.header.mas_centerY).with.offset(0);
  74 + make.right.equalTo(self.mas_right).with.offset(-margin);
  75 + make.width.height.offset(35);
  76 +
  77 + }];
  78 +
66 [_name mas_makeConstraints:^(MASConstraintMaker *make) { 79 [_name mas_makeConstraints:^(MASConstraintMaker *make) {
67 make.top.equalTo(self.header.mas_top); 80 make.top.equalTo(self.header.mas_top);
68 make.left.equalTo(self.header.mas_right).with.offset(margin/2.0); 81 make.left.equalTo(self.header.mas_right).with.offset(margin/2.0);
69 - make.right.equalTo(self.mas_right).with.offset(-margin); 82 + make.right.equalTo(self.reset.mas_left).with.offset(0);
70 make.height.offset(30); 83 make.height.offset(30);
71 84
72 }]; 85 }];
@@ -159,6 +172,12 @@ static const CGFloat timeValue = 1.5; @@ -159,6 +172,12 @@ static const CGFloat timeValue = 1.5;
159 // Drawing code 172 // Drawing code
160 } 173 }
161 */ 174 */
  175 +#pragma mark - 响应方法
  176 +- (void)resetDidClicked:(UIButton *)btn{
  177 + [self generateQRCode:@"reset"];
  178 +
  179 +}
  180 +
162 #pragma mark - 懒加载 181 #pragma mark - 懒加载
163 - (UIImageView *)header { 182 - (UIImageView *)header {
164 if (!_header) { 183 if (!_header) {
@@ -191,6 +210,16 @@ static const CGFloat timeValue = 1.5; @@ -191,6 +210,16 @@ static const CGFloat timeValue = 1.5;
191 } 210 }
192 return _address; 211 return _address;
193 } 212 }
  213 +- (UIButton *)reset{
  214 + if(!_reset){
  215 + _reset = [UIButton buttonWithType:UIButtonTypeCustom];
  216 + UIImage *xw_image = [self getImageWithImageName:@"code_refresh" bundleName:@"CNLiveQrCodeModule" targetClass:[self class]];
  217 + [_reset setImage:xw_image forState:UIControlStateNormal];
  218 + [_reset addTarget:self action:@selector(resetDidClicked:) forControlEvents:UIControlEventTouchUpInside];
  219 + }
  220 + return _reset;
  221 +
  222 +}
194 - (UIImageView *)qrCode { 223 - (UIImageView *)qrCode {
195 if (!_qrCode) { 224 if (!_qrCode) {
196 _qrCode = [[UIImageView alloc] init]; 225 _qrCode = [[UIImageView alloc] init];
Example/CNLiveQrCodeModule/CNLIVEAppDelegate.m
@@ -50,9 +50,9 @@ @@ -50,9 +50,9 @@
50 @"gender":@"m", 50 @"gender":@"m",
51 @"hUid":@"", 51 @"hUid":@"",
52 @"isNewUser":@"0", 52 @"isNewUser":@"0",
53 - @"location":@"北京市海淀区", 53 + @"location":@"北京市海淀区金金帝金帝v金帝v'vv金帝金帝v金帝v金帝金帝金帝金帝帝",
54 @"mobile":@"17600922519", 54 @"mobile":@"17600922519",
55 - @"nickName":@"金帝", 55 + @"nickName":@"金金帝金帝v金帝v'vv金帝金帝v金帝v金帝金帝金帝金帝帝",
56 @"platformId":@"769_jetj7bq525", 56 @"platformId":@"769_jetj7bq525",
57 @"qqUid":@"", 57 @"qqUid":@"",
58 @"renrenUid":@"", 58 @"renrenUid":@"",
@@ -63,7 +63,7 @@ @@ -63,7 +63,7 @@
63 }]; 63 }];
64 self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 64 self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
65 65
66 - CNLiveGenerateQrCodeController *vc = [[CNLiveGenerateQrCodeController alloc] init]; 66 + CNLiveMyQrCodeController *vc = [[CNLiveMyQrCodeController alloc] init];
67 // vc.ID = @"http://www.baidu.com"; 67 // vc.ID = @"http://www.baidu.com";
68 UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc]; 68 UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc];
69 69