Commit 02b5da65b26fb047dcb1255f00e0c2fe943ad7c4
1 parent
a6599e03
no message
Showing
2 changed files
with
33 additions
and
4 deletions
CNLiveQrCodeModule/Classes/View/CNLiveMyQrCodeView.m
| ... | ... | @@ -22,6 +22,8 @@ |
| 22 | 22 | @property (nonatomic, strong) UIImageView *header; |
| 23 | 23 | @property (nonatomic, strong) UILabel *name; |
| 24 | 24 | @property (nonatomic, strong) UILabel *address; |
| 25 | +@property (nonatomic, strong) UIButton *reset; | |
| 26 | + | |
| 25 | 27 | @property (nonatomic, strong) UIImageView *qrCode; |
| 26 | 28 | |
| 27 | 29 | @property (nonatomic, strong) UILabel *friends; |
| ... | ... | @@ -52,10 +54,14 @@ static const CGFloat timeValue = 1.5; |
| 52 | 54 | |
| 53 | 55 | - (void)createSubViews { |
| 54 | 56 | [self addSubview:self.header]; |
| 57 | + [self addSubview:self.reset]; | |
| 58 | + | |
| 55 | 59 | [self addSubview:self.name]; |
| 56 | 60 | [self addSubview:self.address]; |
| 61 | + | |
| 57 | 62 | [self addSubview:self.qrCode]; |
| 58 | 63 | [self addSubview:self.friends]; |
| 64 | + | |
| 59 | 65 | [_header mas_makeConstraints:^(MASConstraintMaker *make) { |
| 60 | 66 | make.left.equalTo(self.mas_left).with.offset(margin); |
| 61 | 67 | make.top.equalTo(self.mas_top).with.offset(margin); |
| ... | ... | @@ -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 | 79 | [_name mas_makeConstraints:^(MASConstraintMaker *make) { |
| 67 | 80 | make.top.equalTo(self.header.mas_top); |
| 68 | 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 | 83 | make.height.offset(30); |
| 71 | 84 | |
| 72 | 85 | }]; |
| ... | ... | @@ -159,6 +172,12 @@ static const CGFloat timeValue = 1.5; |
| 159 | 172 | // Drawing code |
| 160 | 173 | } |
| 161 | 174 | */ |
| 175 | +#pragma mark - 响应方法 | |
| 176 | +- (void)resetDidClicked:(UIButton *)btn{ | |
| 177 | + [self generateQRCode:@"reset"]; | |
| 178 | + | |
| 179 | +} | |
| 180 | + | |
| 162 | 181 | #pragma mark - 懒加载 |
| 163 | 182 | - (UIImageView *)header { |
| 164 | 183 | if (!_header) { |
| ... | ... | @@ -191,6 +210,16 @@ static const CGFloat timeValue = 1.5; |
| 191 | 210 | } |
| 192 | 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 | 223 | - (UIImageView *)qrCode { |
| 195 | 224 | if (!_qrCode) { |
| 196 | 225 | _qrCode = [[UIImageView alloc] init]; | ... | ... |
Example/CNLiveQrCodeModule/CNLIVEAppDelegate.m
| ... | ... | @@ -50,9 +50,9 @@ |
| 50 | 50 | @"gender":@"m", |
| 51 | 51 | @"hUid":@"", |
| 52 | 52 | @"isNewUser":@"0", |
| 53 | - @"location":@"北京市海淀区", | |
| 53 | + @"location":@"北京市海淀区金金帝金帝v金帝v'vv金帝金帝v金帝v金帝金帝金帝金帝帝", | |
| 54 | 54 | @"mobile":@"17600922519", |
| 55 | - @"nickName":@"金帝", | |
| 55 | + @"nickName":@"金金帝金帝v金帝v'vv金帝金帝v金帝v金帝金帝金帝金帝帝", | |
| 56 | 56 | @"platformId":@"769_jetj7bq525", |
| 57 | 57 | @"qqUid":@"", |
| 58 | 58 | @"renrenUid":@"", |
| ... | ... | @@ -63,7 +63,7 @@ |
| 63 | 63 | }]; |
| 64 | 64 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; |
| 65 | 65 | |
| 66 | - CNLiveGenerateQrCodeController *vc = [[CNLiveGenerateQrCodeController alloc] init]; | |
| 66 | + CNLiveMyQrCodeController *vc = [[CNLiveMyQrCodeController alloc] init]; | |
| 67 | 67 | // vc.ID = @"http://www.baidu.com"; |
| 68 | 68 | UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc]; |
| 69 | 69 | ... | ... |