Commit d78736da9708ec2aa0cbe50fc3bcc32a00e3e2b5
1 parent
2bf37f4f
no message
Showing
12 changed files
with
96 additions
and
154 deletions
CNLiveLoginModule.podspec
CNLiveLoginModule/Classes/Controller/CNLiveLoginController.m
| ... | ... | @@ -13,6 +13,7 @@ |
| 13 | 13 | #import "YYKit.h" |
| 14 | 14 | |
| 15 | 15 | #import "CNLiveUserAgreementManager.h" |
| 16 | +#import "CNLiveCategory.h" | |
| 16 | 17 | |
| 17 | 18 | #import "CNLiveLoginView.h" |
| 18 | 19 | #import "CNLiveThreeLoginView.h" |
| ... | ... | @@ -143,7 +144,7 @@ |
| 143 | 144 | _close = [UIButton buttonWithType:UIButtonTypeCustom]; |
| 144 | 145 | _close.frame = CGRectMake(SCREEN_WIDTH-44-10, StatusBarHeight, 44, 44); |
| 145 | 146 | _close.hidden = !self.isShowClose; |
| 146 | - UIImage *image = [self xw_getImageName:@"login_close" bundleName:@"CNLiveLoginModule" targetClass:[self class]]; | |
| 147 | + UIImage *image = [UIImage cn_getImageName:@"login_close" bundleName:@"CNLiveLoginModule" targetClass:[self class]]; | |
| 147 | 148 | [_close setImage:image forState:UIControlStateNormal]; |
| 148 | 149 | [_close addTarget:self action:@selector(closeDidSelected:) forControlEvents:UIControlEventTouchUpInside]; |
| 149 | 150 | _close.adjustsImageWhenHighlighted = NO; |
| ... | ... | @@ -152,20 +153,4 @@ |
| 152 | 153 | |
| 153 | 154 | } |
| 154 | 155 | |
| 155 | -/** | |
| 156 | - * 创建图片 | |
| 157 | - * | |
| 158 | - * @param imageName 图片名字 | |
| 159 | - * @param bundleName 图片所在的bundle名字 | |
| 160 | - * @param targetClass 类和bundle的同级目录 | |
| 161 | - * @return 返回UIImage | |
| 162 | - */ | |
| 163 | -- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{ | |
| 164 | - NSBundle *bundle = [NSBundle bundleForClass:targetClass]; | |
| 165 | - NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"]; | |
| 166 | - NSBundle *targetBundle = [NSBundle bundleWithURL:url]; | |
| 167 | - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil]; | |
| 168 | - return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]; | |
| 169 | -} | |
| 170 | - | |
| 171 | 156 | @end | ... | ... |
CNLiveLoginModule/Classes/Model/CNLiveLoginRequestModel.m
| ... | ... | @@ -28,7 +28,6 @@ |
| 28 | 28 | if (responseObject && ![responseObject isKindOfClass:[NSNull class]] && [responseObject isKindOfClass:[NSDictionary class]] && [[responseObject allKeys] containsObject:@"data"] && [[responseObject objectForKey:@"data"] isKindOfClass:[NSDictionary class]]) { |
| 29 | 29 | NSNumber *code = responseObject[@"errorCode"]; |
| 30 | 30 | if (code && code.intValue == 0) { |
| 31 | -// self.userSig = responseObject[@"data"][@"token"]; | |
| 32 | 31 | if (successBlock) { |
| 33 | 32 | successBlock(responseObject[@"data"][@"token"]); |
| 34 | 33 | } | ... | ... |
CNLiveLoginModule/Classes/ThreeLogin/CNLiveBindingTelController.m
| ... | ... | @@ -12,12 +12,15 @@ |
| 12 | 12 | #import "NSAttributedString+YYText.h" |
| 13 | 13 | #import "QMUIKit.h" |
| 14 | 14 | |
| 15 | +#import "CNLiveLoginNavigationBar.h" | |
| 15 | 16 | #import "CNLiveBindingTelView.h" |
| 16 | 17 | |
| 17 | -@interface CNLiveBindingTelController()<CNLiveBindingTelViewDelegate> | |
| 18 | +@interface CNLiveBindingTelController()<CNLiveBindingTelViewDelegate, CNLiveLoginNavigationBarDelegate> | |
| 18 | 19 | @property (nonatomic, assign) CNLiveThreeLoginType type; |
| 19 | -@property (nonatomic, weak) CNLiveBindingTelView *bindingTelView; | |
| 20 | -@property (nonatomic, weak) YYLabel *protocol; | |
| 20 | +@property (nonatomic, strong) CNLiveLoginNavigationBar *navigationBar; | |
| 21 | + | |
| 22 | +@property (nonatomic, strong) CNLiveBindingTelView *bindingTelView; | |
| 23 | +@property (nonatomic, strong) YYLabel *protocol; | |
| 21 | 24 | |
| 22 | 25 | @end |
| 23 | 26 | |
| ... | ... | @@ -26,11 +29,15 @@ |
| 26 | 29 | self = [super init]; |
| 27 | 30 | if (self) { |
| 28 | 31 | self.type = type; |
| 29 | - | |
| 30 | 32 | } |
| 31 | 33 | return self; |
| 32 | 34 | |
| 33 | 35 | } |
| 36 | +#pragma mark - 生命周期 | |
| 37 | +- (void)viewWillAppear:(BOOL)animated{ | |
| 38 | + [super viewWillAppear:animated]; | |
| 39 | + self.navigationController.navigationBarHidden = YES; | |
| 40 | +} | |
| 34 | 41 | |
| 35 | 42 | - (void)viewDidLoad { |
| 36 | 43 | [super viewDidLoad]; |
| ... | ... | @@ -40,34 +47,10 @@ |
| 40 | 47 | self.extendedLayoutIncludesOpaqueBars = YES; |
| 41 | 48 | self.edgesForExtendedLayout = UIRectEdgeBottom; |
| 42 | 49 | self.view.backgroundColor = [UIColor whiteColor]; |
| 43 | - self.title = @"绑定手机号"; | |
| 44 | - | |
| 45 | - CNLiveBindingTelView *bindingTelView = [[CNLiveBindingTelView alloc] initWithFrame:CGRectMake(self.view.frame.size.width/8.0, NavigationContentTop, self.view.frame.size.width*3/4.0, 400) type:self.type]; | |
| 46 | - bindingTelView.delegate = self; | |
| 47 | - [self.view addSubview:bindingTelView]; | |
| 48 | - self.bindingTelView = bindingTelView; | |
| 49 | 50 | |
| 50 | - YYLabel *protocol = [[YYLabel alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height-30-NavigationContentTop-SafeAreaInsetsConstantForDeviceWithNotch.bottom, self.view.frame.size.width, 30)]; | |
| 51 | - protocol.textAlignment = NSTextAlignmentCenter; | |
| 52 | - protocol.textColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0]; | |
| 53 | - protocol.font = [UIFont systemFontOfSize:14.0]; | |
| 54 | - NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:@"已阅读并同意《账户绑定确认书(网家家)》"]; | |
| 55 | - NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; | |
| 56 | - style.alignment = NSTextAlignmentCenter;//对齐方式 | |
| 57 | - [text addAttribute:NSParagraphStyleAttributeName value:style range:NSMakeRange(0, text.length)]; | |
| 58 | - text.color = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0]; | |
| 59 | - text.font = [UIFont systemFontOfSize:14.0]; | |
| 60 | - __weak typeof(self) weakSelf = self; | |
| 61 | - [text setTextHighlightRange:NSMakeRange(7, 12) color:[UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0] backgroundColor:[UIColor clearColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { | |
| 62 | - __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 63 | - if(!strongSelf) return; | |
| 64 | - [strongSelf.view endEditing:YES]; | |
| 65 | -// [XWAgreementManager jumpToAgreementH5WithType:XWAgreementTypeBindingLogin]; | |
| 66 | - | |
| 67 | - }]; | |
| 68 | - protocol.attributedText = text; | |
| 69 | - [self.view addSubview:protocol]; | |
| 70 | - self.protocol = protocol; | |
| 51 | + [self.view addSubview:self.navigationBar]; | |
| 52 | + [self.view addSubview:self.bindingTelView]; | |
| 53 | + [self.view addSubview:self.protocol]; | |
| 71 | 54 | |
| 72 | 55 | } |
| 73 | 56 | |
| ... | ... | @@ -80,6 +63,19 @@ |
| 80 | 63 | - (void)bindingSuccess:(CNLiveBindingTelView *)view type:(CNLiveThreeLoginType)type{ |
| 81 | 64 | |
| 82 | 65 | } |
| 66 | +#pragma mark - CNLiveLoginNavigationBarDelegate | |
| 67 | +- (void)navigationBar:(CNLiveLoginNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{ | |
| 68 | + if ([actionEvents isEqualToString:@"1"]) { | |
| 69 | + if (self.navigationController.topViewController == self) { | |
| 70 | + [self.navigationController popViewControllerAnimated:YES]; | |
| 71 | + }else{ | |
| 72 | + [self dismissViewControllerAnimated:YES completion:nil]; | |
| 73 | + } | |
| 74 | + | |
| 75 | + }else if ([actionEvents isEqualToString:@"2"]){ | |
| 76 | + | |
| 77 | + } | |
| 78 | +} | |
| 83 | 79 | |
| 84 | 80 | /* |
| 85 | 81 | #pragma mark - Navigation |
| ... | ... | @@ -90,5 +86,50 @@ |
| 90 | 86 | // Pass the selected object to the new view controller. |
| 91 | 87 | } |
| 92 | 88 | */ |
| 89 | +#pragma mark - 懒加载 | |
| 90 | +- (CNLiveLoginNavigationBar *)navigationBar { | |
| 91 | + if (!_navigationBar) { | |
| 92 | + _navigationBar = [[CNLiveLoginNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)]; | |
| 93 | + _navigationBar.backgroundColor = [UIColor whiteColor]; | |
| 94 | + _navigationBar.delegate = self; | |
| 95 | + _navigationBar.title.text = @"绑定手机号"; | |
| 96 | + _navigationBar.right = nil; | |
| 97 | + } | |
| 98 | + return _navigationBar; | |
| 99 | +} | |
| 100 | + | |
| 101 | +- (CNLiveBindingTelView *)bindingTelView { | |
| 102 | + if (!_bindingTelView) { | |
| 103 | + _bindingTelView = [[CNLiveBindingTelView alloc] initWithFrame:CGRectMake(self.view.frame.size.width/8.0, NavigationContentTop, self.view.frame.size.width*3/4.0, 400) type:self.type]; | |
| 104 | + _bindingTelView.delegate = self; | |
| 105 | + } | |
| 106 | + return _bindingTelView; | |
| 107 | +} | |
| 108 | + | |
| 109 | +- (YYLabel *)protocol { | |
| 110 | + if (!_protocol) { | |
| 111 | + _protocol = [[YYLabel alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height-30-NavigationContentTop-SafeAreaInsetsConstantForDeviceWithNotch.bottom, self.view.frame.size.width, 30)]; | |
| 112 | + _protocol.textAlignment = NSTextAlignmentCenter; | |
| 113 | + _protocol.textColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0]; | |
| 114 | + _protocol.font = [UIFont systemFontOfSize:14.0]; | |
| 115 | + NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:@"已阅读并同意《账户绑定确认书(网家家)》"]; | |
| 116 | + NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; | |
| 117 | + style.alignment = NSTextAlignmentCenter;//对齐方式 | |
| 118 | + [text addAttribute:NSParagraphStyleAttributeName value:style range:NSMakeRange(0, text.length)]; | |
| 119 | + text.color = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0]; | |
| 120 | + text.font = [UIFont systemFontOfSize:14.0]; | |
| 121 | + __weak typeof(self) weakSelf = self; | |
| 122 | + [text setTextHighlightRange:NSMakeRange(7, 12) color:[UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0] backgroundColor:[UIColor clearColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { | |
| 123 | + __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 124 | + if(!strongSelf) return; | |
| 125 | + [strongSelf.view endEditing:YES]; | |
| 126 | + // [XWAgreementManager jumpToAgreementH5WithType:XWAgreementTypeBindingLogin]; | |
| 127 | + | |
| 128 | + }]; | |
| 129 | + _protocol.attributedText = text; | |
| 130 | + | |
| 131 | + } | |
| 132 | + return _protocol; | |
| 133 | +} | |
| 93 | 134 | |
| 94 | 135 | @end | ... | ... |
CNLiveLoginModule/Classes/ThreeLogin/CNLiveBindingTelView.m
| ... | ... | @@ -9,6 +9,7 @@ |
| 9 | 9 | #import "CNLiveBindingTelView.h" |
| 10 | 10 | #import "YYKit.h" |
| 11 | 11 | #import "QMUIKit.h" |
| 12 | +#import "CNLiveCategory.h" | |
| 12 | 13 | |
| 13 | 14 | #import "CNLiveLoginCountryView.h" |
| 14 | 15 | #import "CNLiveLoginTextField.h" |
| ... | ... | @@ -78,7 +79,7 @@ static const NSInteger timeValue = 1.5; |
| 78 | 79 | countDown.dataSource = self; |
| 79 | 80 | countDown.delegate = self; |
| 80 | 81 | countDown.frame = CGRectMake(frame.size.width-80, account.bottom+space+10, 80, rowHeight-10); |
| 81 | - UIImage *image2 = [self xw_getImageName:@"login_get_code" bundleName:@"CNLiveLoginModule" targetClass:[self class]]; | |
| 82 | + UIImage *image2 = [UIImage cn_getImageName:@"login_get_code" bundleName:@"CNLiveLoginModule" targetClass:[self class]]; | |
| 82 | 83 | [countDown setImage:image2 forState:UIControlStateNormal]; |
| 83 | 84 | countDown.adjustsImageWhenHighlighted = NO; |
| 84 | 85 | [countDown setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |
| ... | ... | @@ -253,7 +254,7 @@ static const NSInteger timeValue = 1.5; |
| 253 | 254 | button.backgroundColor = [UIColor whiteColor]; |
| 254 | 255 | button.userInteractionEnabled = YES; |
| 255 | 256 | [button setTitle:@"" forState:UIControlStateNormal]; |
| 256 | - UIImage *image2 = [self xw_getImageName:@"login_get_code" bundleName:@"CNLiveLoginModule" targetClass:[self class]]; | |
| 257 | + UIImage *image2 = [UIImage cn_getImageName:@"login_get_code" bundleName:@"CNLiveLoginModule" targetClass:[self class]]; | |
| 257 | 258 | [button setImage:image2 forState:UIControlStateNormal]; |
| 258 | 259 | } |
| 259 | 260 | |
| ... | ... | @@ -292,20 +293,5 @@ static const NSInteger timeValue = 1.5; |
| 292 | 293 | |
| 293 | 294 | } |
| 294 | 295 | |
| 295 | -/** | |
| 296 | - * 创建图片 | |
| 297 | - * | |
| 298 | - * @param imageName 图片名字 | |
| 299 | - * @param bundleName 图片所在的bundle名字 | |
| 300 | - * @param targetClass 类和bundle的同级目录 | |
| 301 | - * @return 返回UIImage | |
| 302 | - */ | |
| 303 | -- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{ | |
| 304 | - NSBundle *bundle = [NSBundle bundleForClass:targetClass]; | |
| 305 | - NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"]; | |
| 306 | - NSBundle *targetBundle = [NSBundle bundleWithURL:url]; | |
| 307 | - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil]; | |
| 308 | - return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]; | |
| 309 | -} | |
| 310 | 296 | |
| 311 | 297 | @end | ... | ... |
CNLiveLoginModule/Classes/ThreeLogin/CNLiveThreeLoginView.m
| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | |
| 9 | 9 | #import "CNLiveThreeLoginView.h" |
| 10 | 10 | #import "YYKit.h" |
| 11 | +#import "CNLiveCategory.h" | |
| 11 | 12 | |
| 12 | 13 | //#import "WXApi.h" |
| 13 | 14 | |
| ... | ... | @@ -56,7 +57,7 @@ static NSInteger const rowHeight = 80; |
| 56 | 57 | UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; |
| 57 | 58 | btn.tag = 10000+i; |
| 58 | 59 | btn.frame = CGRectMake(btnWidth*i, name.bottom, btnWidth, rowHeight); |
| 59 | - UIImage *image = [self xw_getImageName:pics[i] bundleName:@"CNLiveLoginModule" targetClass:[self class]]; | |
| 60 | + UIImage *image = [UIImage cn_getImageName:pics[i] bundleName:@"CNLiveLoginModule" targetClass:[self class]]; | |
| 60 | 61 | [btn setImage:image forState:UIControlStateNormal]; |
| 61 | 62 | btn.adjustsImageWhenHighlighted = NO; |
| 62 | 63 | [btn addTarget:self action:@selector(btnDidClicked:) forControlEvents:UIControlEventTouchUpInside]; |
| ... | ... | @@ -103,20 +104,4 @@ static NSInteger const rowHeight = 80; |
| 103 | 104 | } |
| 104 | 105 | */ |
| 105 | 106 | |
| 106 | -/** | |
| 107 | - * 创建图片 | |
| 108 | - * | |
| 109 | - * @param imageName 图片名字 | |
| 110 | - * @param bundleName 图片所在的bundle名字 | |
| 111 | - * @param targetClass 类和bundle的同级目录 | |
| 112 | - * @return 返回UIImage | |
| 113 | - */ | |
| 114 | -- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{ | |
| 115 | - NSBundle *bundle = [NSBundle bundleForClass:targetClass]; | |
| 116 | - NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"]; | |
| 117 | - NSBundle *targetBundle = [NSBundle bundleWithURL:url]; | |
| 118 | - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil]; | |
| 119 | - return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]; | |
| 120 | -} | |
| 121 | - | |
| 122 | 107 | @end | ... | ... |
CNLiveLoginModule/Classes/View/CNLiveCompleteInfoView.m
| ... | ... | @@ -25,6 +25,8 @@ |
| 25 | 25 | #import "CommonLibrary.h" |
| 26 | 26 | #import "NBSAppAgent.h" |
| 27 | 27 | #import "CNLiveBusinessTools.h" |
| 28 | +#import "CNLiveCategory.h" | |
| 29 | + | |
| 28 | 30 | #import "CNLiveLoginRequestModel.h" |
| 29 | 31 | |
| 30 | 32 | @interface CNLiveCompleteInfoView()<UITextFieldDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate,TZImagePickerControllerDelegate,QMUIAlertControllerDelegate>{ |
| ... | ... | @@ -60,7 +62,7 @@ static const NSInteger timeValue = 1.5; |
| 60 | 62 | head.layer.cornerRadius = 40; |
| 61 | 63 | head.layer.masksToBounds = YES; |
| 62 | 64 | head.adjustsImageWhenHighlighted = NO; |
| 63 | - UIImage *image = [self xw_getImageName:@"login_camera" bundleName:@"CNLiveLoginModule" targetClass:[self class]]; | |
| 65 | + UIImage *image = [UIImage cn_getImageName:@"login_camera" bundleName:@"CNLiveLoginModule" targetClass:[self class]]; | |
| 64 | 66 | [head setImage:image forState:UIControlStateNormal]; |
| 65 | 67 | [head addTarget:self action:@selector(headDidClicked:) forControlEvents:UIControlEventTouchUpInside]; |
| 66 | 68 | [self addSubview:head]; |
| ... | ... | @@ -346,20 +348,4 @@ static const NSInteger timeValue = 1.5; |
| 346 | 348 | } |
| 347 | 349 | */ |
| 348 | 350 | |
| 349 | -/** | |
| 350 | - * 创建图片 | |
| 351 | - * | |
| 352 | - * @param imageName 图片名字 | |
| 353 | - * @param bundleName 图片所在的bundle名字 | |
| 354 | - * @param targetClass 类和bundle的同级目录 | |
| 355 | - * @return 返回UIImage | |
| 356 | - */ | |
| 357 | -- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{ | |
| 358 | - NSBundle *bundle = [NSBundle bundleForClass:targetClass]; | |
| 359 | - NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"]; | |
| 360 | - NSBundle *targetBundle = [NSBundle bundleWithURL:url]; | |
| 361 | - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil]; | |
| 362 | - return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]; | |
| 363 | -} | |
| 364 | - | |
| 365 | 351 | @end | ... | ... |
CNLiveLoginModule/Classes/View/CNLiveLoginCountryView.m
| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | |
| 9 | 9 | #import "CNLiveLoginCountryView.h" |
| 10 | 10 | #import "YYKit.h" |
| 11 | +#import "CNLiveCategory.h" | |
| 11 | 12 | |
| 12 | 13 | #import "CNLiveChooseCountryController.h" |
| 13 | 14 | |
| ... | ... | @@ -46,7 +47,7 @@ |
| 46 | 47 | [code setTitle:[NSString stringWithFormat:@"+%@",_countryCode] forState:UIControlStateNormal]; |
| 47 | 48 | [code setTitleColor:[UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0] forState:UIControlStateNormal]; |
| 48 | 49 | code.titleLabel.font = [UIFont systemFontOfSize:14]; |
| 49 | - UIImage *image = [self xw_getImageName:@"login_country" bundleName:@"CNLiveLoginModule" targetClass:[self class]]; | |
| 50 | + UIImage *image = [UIImage cn_getImageName:@"login_country" bundleName:@"CNLiveLoginModule" targetClass:[self class]]; | |
| 50 | 51 | [code setImage:image forState:UIControlStateNormal]; |
| 51 | 52 | code.adjustsImageWhenHighlighted = NO; |
| 52 | 53 | //button图片的偏移量,距上左下右分别(0, 0, 0, 0)像素点 |
| ... | ... | @@ -88,20 +89,4 @@ |
| 88 | 89 | } |
| 89 | 90 | } |
| 90 | 91 | |
| 91 | -/** | |
| 92 | - * 创建图片 | |
| 93 | - * | |
| 94 | - * @param imageName 图片名字 | |
| 95 | - * @param bundleName 图片所在的bundle名字 | |
| 96 | - * @param targetClass 类和bundle的同级目录 | |
| 97 | - * @return 返回UIImage | |
| 98 | - */ | |
| 99 | -- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{ | |
| 100 | - NSBundle *bundle = [NSBundle bundleForClass:targetClass]; | |
| 101 | - NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"]; | |
| 102 | - NSBundle *targetBundle = [NSBundle bundleWithURL:url]; | |
| 103 | - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil]; | |
| 104 | - return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]; | |
| 105 | -} | |
| 106 | - | |
| 107 | 92 | @end | ... | ... |
CNLiveLoginModule/Classes/View/CNLiveLoginNavigationBar.m
| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | |
| 9 | 9 | #import "CNLiveLoginNavigationBar.h" |
| 10 | 10 | #import "QMUIKit.h" |
| 11 | +#import "CNLiveCategory.h" | |
| 11 | 12 | |
| 12 | 13 | @interface CNLiveLoginNavigationBar () |
| 13 | 14 | |
| ... | ... | @@ -59,7 +60,7 @@ static const NSInteger margin = 15; |
| 59 | 60 | _left= [UIButton buttonWithType:UIButtonTypeCustom]; |
| 60 | 61 | _left.adjustsImageWhenHighlighted = NO; |
| 61 | 62 | _left.frame = CGRectMake(margin, StatusBarHeight, NavigationBarHeight, NavigationBarHeight); |
| 62 | - UIImage *image = [self xw_getImageName:@"mine_back_black_b" bundleName:@"CNLiveLoginModule" targetClass:[self class]]; | |
| 63 | + UIImage *image = [UIImage cn_getImageName:@"mine_back_black_b" bundleName:@"CNLiveLoginModule" targetClass:[self class]]; | |
| 63 | 64 | [_left setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal]; |
| 64 | 65 | _left.titleLabel.font = [UIFont systemFontOfSize:15]; |
| 65 | 66 | [_left setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft]; |
| ... | ... | @@ -103,21 +104,4 @@ static const NSInteger margin = 15; |
| 103 | 104 | } |
| 104 | 105 | } |
| 105 | 106 | |
| 106 | -/** | |
| 107 | - * 创建图片 | |
| 108 | - * | |
| 109 | - * @param imageName 图片名字 | |
| 110 | - * @param bundleName 图片所在的bundle名字 | |
| 111 | - * @param targetClass 类和bundle的同级目录 | |
| 112 | - * @return 返回UIImage | |
| 113 | - */ | |
| 114 | -- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{ | |
| 115 | - NSBundle *bundle = [NSBundle bundleForClass:targetClass]; | |
| 116 | - NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"]; | |
| 117 | - NSBundle *targetBundle = [NSBundle bundleWithURL:url]; | |
| 118 | - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil]; | |
| 119 | - return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]; | |
| 120 | - | |
| 121 | -} | |
| 122 | - | |
| 123 | 107 | @end | ... | ... |
CNLiveLoginModule/Classes/View/CNLiveLoginView.m
| ... | ... | @@ -15,6 +15,7 @@ |
| 15 | 15 | #import <CNLiveUserSystemSDK/CNLiveUserSystemTypeDef.h> |
| 16 | 16 | #import "CNUserInfoManager.h" |
| 17 | 17 | #import "CNLiveEnvironment.h" |
| 18 | +#import "CNLiveCategory.h" | |
| 18 | 19 | |
| 19 | 20 | #import "CNLiveLoginCountryView.h" |
| 20 | 21 | #import "CNLiveLoginTextField.h" |
| ... | ... | @@ -56,7 +57,7 @@ static const NSInteger timeValue = 1.5; |
| 56 | 57 | } |
| 57 | 58 | - (void)createSubviews:(CGRect)frame{ |
| 58 | 59 | UIImageView *logo = [[UIImageView alloc] initWithFrame:CGRectMake((frame.size.width-75)/2.0, 0, 75, 100)]; |
| 59 | - UIImage *image = [self xw_getImageName:@"login_logo" bundleName:@"CNLiveLoginModule" targetClass:[self class]]; | |
| 60 | + UIImage *image = [UIImage cn_getImageName:@"login_logo" bundleName:@"CNLiveLoginModule" targetClass:[self class]]; | |
| 60 | 61 | logo.image = image; |
| 61 | 62 | [self addSubview:logo]; |
| 62 | 63 | self.logo = logo; |
| ... | ... | @@ -96,7 +97,7 @@ static const NSInteger timeValue = 1.5; |
| 96 | 97 | countDown.dataSource = self; |
| 97 | 98 | countDown.delegate = self; |
| 98 | 99 | countDown.frame = CGRectMake(frame.size.width-80, account.bottom+space+10, 80, rowHeight-10); |
| 99 | - UIImage *image2 = [self xw_getImageName:@"login_get_code" bundleName:@"CNLiveLoginModule" targetClass:[self class]]; | |
| 100 | + UIImage *image2 = [UIImage cn_getImageName:@"login_get_code" bundleName:@"CNLiveLoginModule" targetClass:[self class]]; | |
| 100 | 101 | [countDown setImage:image2 forState:UIControlStateNormal]; |
| 101 | 102 | countDown.adjustsImageWhenHighlighted = NO; |
| 102 | 103 | [countDown setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |
| ... | ... | @@ -296,7 +297,7 @@ static const NSInteger timeValue = 1.5; |
| 296 | 297 | button.backgroundColor = [UIColor whiteColor]; |
| 297 | 298 | button.userInteractionEnabled = YES; |
| 298 | 299 | [button setTitle:@"" forState:UIControlStateNormal]; |
| 299 | - UIImage *image2 = [self xw_getImageName:@"login_get_code" bundleName:@"CNLiveLoginModule" targetClass:[self class]]; | |
| 300 | + UIImage *image2 = [UIImage cn_getImageName:@"login_get_code" bundleName:@"CNLiveLoginModule" targetClass:[self class]]; | |
| 300 | 301 | [button setImage:image2 forState:UIControlStateNormal]; |
| 301 | 302 | } |
| 302 | 303 | |
| ... | ... | @@ -357,20 +358,4 @@ static const NSInteger timeValue = 1.5; |
| 357 | 358 | } |
| 358 | 359 | } |
| 359 | 360 | |
| 360 | -/** | |
| 361 | - * 创建图片 | |
| 362 | - * | |
| 363 | - * @param imageName 图片名字 | |
| 364 | - * @param bundleName 图片所在的bundle名字 | |
| 365 | - * @param targetClass 类和bundle的同级目录 | |
| 366 | - * @return 返回UIImage | |
| 367 | - */ | |
| 368 | -- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{ | |
| 369 | - NSBundle *bundle = [NSBundle bundleForClass:targetClass]; | |
| 370 | - NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"]; | |
| 371 | - NSBundle *targetBundle = [NSBundle bundleWithURL:url]; | |
| 372 | - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil]; | |
| 373 | - return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]; | |
| 374 | -} | |
| 375 | - | |
| 376 | 361 | @end | ... | ... |
Example/CNLiveLoginModule.xcodeproj/project.pbxproj
| ... | ... | @@ -335,6 +335,7 @@ |
| 335 | 335 | "${BUILT_PRODUCTS_DIR}/CNLiveBeeHive/CNLiveBeeHive.framework", |
| 336 | 336 | "${BUILT_PRODUCTS_DIR}/CNLiveBusinessTools/CNLiveBusinessTools.framework", |
| 337 | 337 | "${BUILT_PRODUCTS_DIR}/CNLiveCacheManagerKit/CNLiveCacheManagerKit.framework", |
| 338 | + "${BUILT_PRODUCTS_DIR}/CNLiveCategory/CNLiveCategory.framework", | |
| 338 | 339 | "${BUILT_PRODUCTS_DIR}/CNLiveChooseCountry/CNLiveChooseCountry.framework", |
| 339 | 340 | "${BUILT_PRODUCTS_DIR}/CNLiveCommonCategory/CNLiveCommonCategory.framework", |
| 340 | 341 | "${BUILT_PRODUCTS_DIR}/CNLiveEnvironment/CNLiveEnvironment.framework", |
| ... | ... | @@ -365,6 +366,7 @@ |
| 365 | 366 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBeeHive.framework", |
| 366 | 367 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBusinessTools.framework", |
| 367 | 368 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCacheManagerKit.framework", |
| 369 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCategory.framework", | |
| 368 | 370 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveChooseCountry.framework", |
| 369 | 371 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonCategory.framework", |
| 370 | 372 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveEnvironment.framework", | ... | ... |
Example/CNLiveLoginModule/CNLIVEAppDelegate.m
| ... | ... | @@ -50,6 +50,7 @@ |
| 50 | 50 | }]; |
| 51 | 51 | |
| 52 | 52 | CNLiveLoginController *vc = [[CNLiveLoginController alloc] init]; |
| 53 | + vc.isShowClose = YES; | |
| 53 | 54 | UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc]; |
| 54 | 55 | self.window.rootViewController = nav;//设置根视图控制器 |
| 55 | 56 | [self.window makeKeyAndVisible];//设置成为 | ... | ... |