Commit c16dc7d355fa59fc518a62377fec1e515c756cca
1 parent
5b1cc58e
no message
Showing
11 changed files
with
101 additions
and
265 deletions
CNLiveSettingModule.podspec
CNLiveSettingModule/Classes/AboutUs/CNLiveAboutUsController.m
| ... | ... | @@ -15,14 +15,14 @@ |
| 15 | 15 | #import "CNLiveEnvironment.h" |
| 16 | 16 | #import "CNLiveCategory.h" |
| 17 | 17 | #import "CNLiveBaseKit.h" |
| 18 | +#import "CNLiveNavigationBar.h" | |
| 18 | 19 | |
| 19 | 20 | #import "CNLiveSettingModel.h" |
| 20 | 21 | #import "CNLiveSettingCell.h" |
| 21 | -#import "CNLiveSettingNavigationBar.h" | |
| 22 | 22 | |
| 23 | 23 | @interface CNLiveAboutUsController () |
| 24 | -<UITableViewDelegate, UITableViewDataSource, CNLiveSettingNavigationBarDelegate> | |
| 25 | -@property (nonatomic, strong) CNLiveSettingNavigationBar *navigationBar; | |
| 24 | +<UITableViewDelegate, UITableViewDataSource> | |
| 25 | +@property (nonatomic, strong) CNLiveNavigationBar *navigationBar; | |
| 26 | 26 | @property (nonatomic, strong) UITableView *tableView; |
| 27 | 27 | @property (nonatomic, strong) UIView *headerView; |
| 28 | 28 | @property (nonatomic, strong) UIView *footerView; |
| ... | ... | @@ -231,13 +231,16 @@ static const NSInteger timeValue = 1.5; |
| 231 | 231 | return _data; |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | -- (CNLiveSettingNavigationBar *)navigationBar { | |
| 234 | +- (CNLiveNavigationBar *)navigationBar { | |
| 235 | 235 | if (!_navigationBar) { |
| 236 | - _navigationBar = [[CNLiveSettingNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)]; | |
| 237 | - _navigationBar.backgroundColor = [UIColor whiteColor]; | |
| 238 | - _navigationBar.delegate = self; | |
| 236 | + _navigationBar = [CNLiveNavigationBar navigationBar]; | |
| 239 | 237 | _navigationBar.title.text = [NSString stringWithFormat:@"关于%@",DisplayName]; |
| 240 | - _navigationBar.right = nil; | |
| 238 | + __weak typeof(self) weakSelf = self; | |
| 239 | + _navigationBar.onClickLeftButton = ^{ | |
| 240 | + __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 241 | + if(!strongSelf) return ; | |
| 242 | + [strongSelf goBack]; | |
| 243 | + }; | |
| 241 | 244 | } |
| 242 | 245 | return _navigationBar; |
| 243 | 246 | } |
| ... | ... | @@ -266,7 +269,7 @@ static const NSInteger timeValue = 1.5; |
| 266 | 269 | _headerView.clipsToBounds = YES; |
| 267 | 270 | _headerView.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0]; |
| 268 | 271 | UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-70)/2.0, 30, 70, 140)]; |
| 269 | - UIImage *image = [self getImageWithImageName:@"about_us_icon" bundleName:@"CNLiveSettingModule" targetClass:[CNLiveSettingNavigationBar class]]; | |
| 272 | + UIImage *image = [self getImageWithImageName:@"about_us_icon" bundleName:@"CNLiveSettingModule" targetClass:[self class]]; | |
| 270 | 273 | imageView.image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; |
| 271 | 274 | imageView.contentMode = UIViewContentModeScaleAspectFill; |
| 272 | 275 | imageView.clipsToBounds = YES; |
| ... | ... | @@ -306,13 +309,4 @@ static const NSInteger timeValue = 1.5; |
| 306 | 309 | } |
| 307 | 310 | } |
| 308 | 311 | |
| 309 | -#pragma mark - CNLiveSettingNavigationBarDelegate | |
| 310 | -- (void)navigationBar:(CNLiveSettingNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{ | |
| 311 | - if ([actionEvents isEqualToString:@"1"]) { | |
| 312 | - [self goBack]; | |
| 313 | - }else if ([actionEvents isEqualToString:@"2"]){ | |
| 314 | - | |
| 315 | - } | |
| 316 | -} | |
| 317 | - | |
| 318 | 312 | @end | ... | ... |
CNLiveSettingModule/Classes/BackgroundImage/CNLiveBackgroundImageController.m
| ... | ... | @@ -19,14 +19,14 @@ |
| 19 | 19 | #import "CNLiveSettingModel.h" |
| 20 | 20 | #import "CNLiveSettingCell.h" |
| 21 | 21 | #import "CNLiveServices.h" |
| 22 | -#import "CNLiveSettingNavigationBar.h" | |
| 22 | +#import "CNLiveNavigationBar.h" | |
| 23 | 23 | #import "CNLiveBaseKit.h" |
| 24 | 24 | |
| 25 | 25 | @interface CNLiveBackgroundImageController () |
| 26 | -<UITableViewDelegate, UITableViewDataSource, CNLiveSettingNavigationBarDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate,TZImagePickerControllerDelegate>{ | |
| 26 | +<UITableViewDelegate, UITableViewDataSource,UIImagePickerControllerDelegate,UINavigationControllerDelegate,TZImagePickerControllerDelegate>{ | |
| 27 | 27 | UIImage *_selectedImage;// 当 isSettingAll为 YES 才需要用到 |
| 28 | 28 | } |
| 29 | -@property (nonatomic, strong) CNLiveSettingNavigationBar *navigationBar; | |
| 29 | +@property (nonatomic, strong) CNLiveNavigationBar *navigationBar; | |
| 30 | 30 | @property (nonatomic, strong) UITableView *tableView; |
| 31 | 31 | @property (nonatomic, strong) UIButton *setting; |
| 32 | 32 | @property (nonatomic, strong) NSMutableArray *data; |
| ... | ... | @@ -159,13 +159,16 @@ static const NSInteger timeValue = 1.5; |
| 159 | 159 | return _data; |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | -- (CNLiveSettingNavigationBar *)navigationBar { | |
| 162 | +- (CNLiveNavigationBar *)navigationBar { | |
| 163 | 163 | if (!_navigationBar) { |
| 164 | - _navigationBar = [[CNLiveSettingNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)]; | |
| 165 | - _navigationBar.backgroundColor = [UIColor whiteColor]; | |
| 166 | - _navigationBar.delegate = self; | |
| 164 | + _navigationBar = [CNLiveNavigationBar navigationBar]; | |
| 167 | 165 | _navigationBar.title.text = @"聊天背景"; |
| 168 | - _navigationBar.right = nil; | |
| 166 | + __weak typeof(self) weakSelf = self; | |
| 167 | + _navigationBar.onClickLeftButton = ^{ | |
| 168 | + __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 169 | + if(!strongSelf) return ; | |
| 170 | + [strongSelf goBack]; | |
| 171 | + }; | |
| 169 | 172 | } |
| 170 | 173 | return _navigationBar; |
| 171 | 174 | } |
| ... | ... | @@ -299,14 +302,5 @@ static const NSInteger timeValue = 1.5; |
| 299 | 302 | }); |
| 300 | 303 | } |
| 301 | 304 | |
| 302 | -#pragma mark - CNLiveSettingNavigationBarDelegate | |
| 303 | -- (void)navigationBar:(CNLiveSettingNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{ | |
| 304 | - if ([actionEvents isEqualToString:@"1"]) { | |
| 305 | - [self goBack]; | |
| 306 | - }else if ([actionEvents isEqualToString:@"2"]){ | |
| 307 | - | |
| 308 | - } | |
| 309 | -} | |
| 310 | - | |
| 311 | 305 | |
| 312 | 306 | @end | ... | ... |
CNLiveSettingModule/Classes/Cancellation/CNLiveCancellationController.m
| ... | ... | @@ -15,15 +15,15 @@ |
| 15 | 15 | #import "CNLiveEnvironment.h" |
| 16 | 16 | #import "CNUserInfoManager.h" |
| 17 | 17 | |
| 18 | -#import "CNLiveSettingNavigationBar.h" | |
| 18 | +#import "CNLiveNavigationBar.h" | |
| 19 | 19 | #import "CNLiveCancellationView.h" |
| 20 | 20 | |
| 21 | 21 | //#import "CNIntegralRulesViewController.h" |
| 22 | 22 | //#import "CNMineHomeController.h" |
| 23 | 23 | #import "CNLiveUserAgreementManager.h" |
| 24 | 24 | |
| 25 | -@interface CNLiveCancellationController ()<WKNavigationDelegate,WKUIDelegate,CNLiveCancellationViewDelegate,CNLiveSettingNavigationBarDelegate> | |
| 26 | -@property (nonatomic, strong) CNLiveSettingNavigationBar *navigationBar; | |
| 25 | +@interface CNLiveCancellationController ()<WKNavigationDelegate,WKUIDelegate,CNLiveCancellationViewDelegate> | |
| 26 | +@property (nonatomic, strong) CNLiveNavigationBar *navigationBar; | |
| 27 | 27 | @property (nonatomic, weak) WKWebView *webView; |
| 28 | 28 | @property (nonatomic, weak) CNLiveCancellationView *cancellationView; |
| 29 | 29 | |
| ... | ... | @@ -243,25 +243,20 @@ static const NSInteger timeValue = 1.5; |
| 243 | 243 | */ |
| 244 | 244 | |
| 245 | 245 | #pragma mark - 懒加载 |
| 246 | -- (CNLiveSettingNavigationBar *)navigationBar { | |
| 246 | +- (CNLiveNavigationBar *)navigationBar { | |
| 247 | 247 | if (!_navigationBar) { |
| 248 | - _navigationBar = [[CNLiveSettingNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)]; | |
| 249 | - _navigationBar.backgroundColor = [UIColor whiteColor]; | |
| 250 | - _navigationBar.delegate = self; | |
| 248 | + _navigationBar = [CNLiveNavigationBar navigationBar]; | |
| 251 | 249 | _navigationBar.title.text = @"审核申请"; |
| 252 | - _navigationBar.right = nil; | |
| 250 | + __weak typeof(self) weakSelf = self; | |
| 251 | + _navigationBar.onClickLeftButton = ^{ | |
| 252 | + __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 253 | + if(!strongSelf) return ; | |
| 254 | + [strongSelf goBack]; | |
| 255 | + }; | |
| 253 | 256 | } |
| 254 | 257 | return _navigationBar; |
| 255 | 258 | } |
| 256 | 259 | |
| 257 | -#pragma mark - CNLiveSettingNavigationBarDelegate | |
| 258 | -- (void)navigationBar:(CNLiveSettingNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{ | |
| 259 | - if ([actionEvents isEqualToString:@"1"]) { | |
| 260 | - [self goBack]; | |
| 261 | - }else if ([actionEvents isEqualToString:@"2"]){ | |
| 262 | - | |
| 263 | - } | |
| 264 | -} | |
| 265 | 260 | #pragma mark - 响应方法 |
| 266 | 261 | - (void)goBack { |
| 267 | 262 | if (self.presentingViewController != nil) { | ... | ... |
CNLiveSettingModule/Classes/Controller/CNLiveSettingController.m
| ... | ... | @@ -17,7 +17,7 @@ |
| 17 | 17 | #import "CNLiveSettingModel.h" |
| 18 | 18 | #import "CNLiveSettingCell.h" |
| 19 | 19 | #import "CNLiveServices.h" |
| 20 | -#import "CNLiveSettingNavigationBar.h" | |
| 20 | +#import "CNLiveNavigationBar.h" | |
| 21 | 21 | |
| 22 | 22 | #import "CNLiveUpdateTelController.h"//修改手机号 |
| 23 | 23 | #import "CNLivePrivacyController.h"//隐私 |
| ... | ... | @@ -28,8 +28,8 @@ |
| 28 | 28 | #import "CNLiveBaseKit.h" |
| 29 | 29 | |
| 30 | 30 | @interface CNLiveSettingController () |
| 31 | -<UITableViewDelegate, UITableViewDataSource, CNLiveSettingNavigationBarDelegate> | |
| 32 | -@property (nonatomic, strong) CNLiveSettingNavigationBar *navigationBar; | |
| 31 | +<UITableViewDelegate, UITableViewDataSource> | |
| 32 | +@property (nonatomic, strong) CNLiveNavigationBar *navigationBar; | |
| 33 | 33 | @property (nonatomic, strong) UITableView *tableView; |
| 34 | 34 | @property (nonatomic, strong) UIButton *logout; |
| 35 | 35 | @property (nonatomic, strong) NSMutableArray *data; |
| ... | ... | @@ -274,13 +274,14 @@ static const NSInteger timeValue = 1.5; |
| 274 | 274 | return _data; |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | -- (CNLiveSettingNavigationBar *)navigationBar { | |
| 277 | +- (CNLiveNavigationBar *)navigationBar { | |
| 278 | 278 | if (!_navigationBar) { |
| 279 | - _navigationBar = [[CNLiveSettingNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)]; | |
| 280 | - _navigationBar.backgroundColor = [UIColor whiteColor]; | |
| 281 | - _navigationBar.delegate = self; | |
| 279 | + _navigationBar = [CNLiveNavigationBar navigationBar]; | |
| 282 | 280 | _navigationBar.title.text = @"设置"; |
| 283 | - _navigationBar.right = nil; | |
| 281 | + __weak typeof(self) weakSelf = self; | |
| 282 | + _navigationBar.onClickLeftButton = ^{ | |
| 283 | + [weakSelf goBack]; | |
| 284 | + }; | |
| 284 | 285 | } |
| 285 | 286 | return _navigationBar; |
| 286 | 287 | } |
| ... | ... | @@ -376,13 +377,4 @@ static const NSInteger timeValue = 1.5; |
| 376 | 377 | }]; |
| 377 | 378 | } |
| 378 | 379 | |
| 379 | -#pragma mark - CNLiveSettingNavigationBarDelegate | |
| 380 | -- (void)navigationBar:(CNLiveSettingNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{ | |
| 381 | - if ([actionEvents isEqualToString:@"1"]) { | |
| 382 | - [self goBack]; | |
| 383 | - }else if ([actionEvents isEqualToString:@"2"]){ | |
| 384 | - | |
| 385 | - } | |
| 386 | -} | |
| 387 | - | |
| 388 | 380 | @end | ... | ... |
CNLiveSettingModule/Classes/FontSIze/CNLiveFontSettingController.m
| ... | ... | @@ -12,14 +12,14 @@ |
| 12 | 12 | #import "CNLiveBaseKit.h" |
| 13 | 13 | #import "CNUserInfoManager.h" |
| 14 | 14 | #import "CNLiveCategory.h" |
| 15 | +#import "CNLiveNavigationBar.h" | |
| 15 | 16 | |
| 16 | -#import "CNLiveSettingNavigationBar.h" | |
| 17 | 17 | #import "CNLiveFontSettingFrame.h" |
| 18 | 18 | #import "CNLiveFontSettingModel.h" |
| 19 | 19 | #import "CNLiveFontSettingCell.h" |
| 20 | 20 | |
| 21 | -@interface CNLiveFontSettingController ()<UITableViewDelegate, UITableViewDataSource, CNLiveSettingNavigationBarDelegate> | |
| 22 | -@property (nonatomic, strong) CNLiveSettingNavigationBar *navigationBar; | |
| 21 | +@interface CNLiveFontSettingController ()<UITableViewDelegate, UITableViewDataSource> | |
| 22 | +@property (nonatomic, strong) CNLiveNavigationBar *navigationBar; | |
| 23 | 23 | @property (nonatomic, strong) UITableView *tableView; |
| 24 | 24 | @property (nonatomic, strong) NSMutableArray *data; |
| 25 | 25 | |
| ... | ... | @@ -157,21 +157,6 @@ |
| 157 | 157 | return FontSettingFrame.cellHeight; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | -#pragma mark - CNLiveSettingNavigationBarDelegate | |
| 161 | -- (void)navigationBar:(CNLiveSettingNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{ | |
| 162 | - if ([actionEvents isEqualToString:@"1"]) { | |
| 163 | - [[NSUserDefaults standardUserDefaults] setInteger:tempCoefficient forKey:@"CNSizeFontCoefficient"]; | |
| 164 | - | |
| 165 | - }else if ([actionEvents isEqualToString:@"2"]){ | |
| 166 | - NSInteger temp = [[NSUserDefaults standardUserDefaults] integerForKey:@"CNSizeFontCoefficient"]; | |
| 167 | - if (temp != tempCoefficient) { | |
| 168 | - [[NSNotificationCenter defaultCenter] postNotificationName:@"CNFONTSIZECHANGE" object:nil]; | |
| 169 | - } | |
| 170 | - } | |
| 171 | - [self goBack]; | |
| 172 | - | |
| 173 | -} | |
| 174 | - | |
| 175 | 160 | #pragma mark - 懒加载 |
| 176 | 161 | - (NSMutableArray *)data{ |
| 177 | 162 | if (_data == nil) { |
| ... | ... | @@ -191,20 +176,35 @@ |
| 191 | 176 | return _tableView; |
| 192 | 177 | } |
| 193 | 178 | |
| 194 | -- (CNLiveSettingNavigationBar *)navigationBar { | |
| 179 | +- (CNLiveNavigationBar *)navigationBar { | |
| 195 | 180 | if (!_navigationBar) { |
| 196 | - _navigationBar = [[CNLiveSettingNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)]; | |
| 197 | - _navigationBar.backgroundColor = [UIColor whiteColor]; | |
| 198 | - _navigationBar.delegate = self; | |
| 199 | - [_navigationBar.left setTitle:@"取消" forState:UIControlStateNormal]; | |
| 200 | - [_navigationBar.left setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; | |
| 181 | + _navigationBar = [CNLiveNavigationBar navigationBar]; | |
| 182 | + _navigationBar.leftTitle = @"取消"; | |
| 201 | 183 | [_navigationBar.left setImage:nil forState:UIControlStateNormal]; |
| 202 | 184 | _navigationBar.title.text = @"设置字体大小"; |
| 203 | 185 | _navigationBar.left.titleLabel.font = [UIFont systemFontOfSize:17.0]; |
| 204 | 186 | _navigationBar.right.titleLabel.font = [UIFont systemFontOfSize:17.0]; |
| 205 | - [_navigationBar.right setTitle:@"完成" forState:UIControlStateNormal]; | |
| 206 | - [_navigationBar.right setTitleColor:[UIColor colorWithRed:31/255.0 green:185/255.0 blue:34/255.0 alpha:1.0] forState:UIControlStateNormal]; | |
| 187 | + _navigationBar.rightTitle = @"完成"; | |
| 188 | + [_navigationBar.right setTitleColor:[UIColor colorWithRed:31/255.0 green:185/255.0 blue:34/255.0 alpha:1.0] forState:UIControlStateNormal]; | |
| 207 | 189 | [_navigationBar.right setTitleColor:[UIColor colorWithRed:63/255.0 green:109/255.0 blue:61/255.0 alpha:1.0] forState:UIControlStateSelected]; |
| 190 | + __weak typeof(self) weakSelf = self; | |
| 191 | + _navigationBar.onClickLeftButton = ^{ | |
| 192 | + __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 193 | + if(!strongSelf) return ; | |
| 194 | + [[NSUserDefaults standardUserDefaults] setInteger:strongSelf->tempCoefficient forKey:@"CNSizeFontCoefficient"]; | |
| 195 | + [strongSelf goBack]; | |
| 196 | + | |
| 197 | + }; | |
| 198 | + _navigationBar.onClickRightButton = ^{ | |
| 199 | + __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 200 | + if(!strongSelf) return ; | |
| 201 | + NSInteger temp = [[NSUserDefaults standardUserDefaults] integerForKey:@"CNSizeFontCoefficient"]; | |
| 202 | + if (temp != strongSelf->tempCoefficient) { | |
| 203 | + [[NSNotificationCenter defaultCenter] postNotificationName:@"CNFONTSIZECHANGE" object:nil]; | |
| 204 | + } | |
| 205 | + [strongSelf goBack]; | |
| 206 | + | |
| 207 | + }; | |
| 208 | 208 | } |
| 209 | 209 | return _navigationBar; |
| 210 | 210 | } | ... | ... |
CNLiveSettingModule/Classes/Privacy/CNLivePrivacyController.m
| ... | ... | @@ -15,8 +15,8 @@ |
| 15 | 15 | #import "CNLiveNetworking.h" |
| 16 | 16 | #import "CNLiveEnvironment.h" |
| 17 | 17 | #import "CNUserInfoManager.h" |
| 18 | +#import "CNLiveNavigationBar.h" | |
| 18 | 19 | |
| 19 | -#import "CNLiveSettingNavigationBar.h" | |
| 20 | 20 | #import "CNLivePrivacyCell.h" |
| 21 | 21 | #import "CNLivePrivacyHeaderView.h" |
| 22 | 22 | #import "CNLivePrivacyModel.h" |
| ... | ... | @@ -25,8 +25,8 @@ |
| 25 | 25 | #import "CNLiveUserDefaultsModel.h" |
| 26 | 26 | #import "CNLivePrivacyRequest.h" |
| 27 | 27 | |
| 28 | -@interface CNLivePrivacyController ()<UITableViewDelegate,UITableViewDataSource,CNLiveSettingNavigationBarDelegate> | |
| 29 | -@property (nonatomic, strong) CNLiveSettingNavigationBar *navigationBar; | |
| 28 | +@interface CNLivePrivacyController ()<UITableViewDelegate,UITableViewDataSource> | |
| 29 | +@property (nonatomic, strong) CNLiveNavigationBar *navigationBar; | |
| 30 | 30 | @property (nonatomic, strong) UITableView *tableView; |
| 31 | 31 | |
| 32 | 32 | @property (nonatomic, strong) CNLivePrivacyModel *model; |
| ... | ... | @@ -189,13 +189,6 @@ |
| 189 | 189 | |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | -#pragma mark - CNLiveSettingNavigationBarDelegate | |
| 193 | -- (void)navigationBar:(CNLiveSettingNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{ | |
| 194 | - if ([actionEvents isEqualToString:@"1"]) { | |
| 195 | - [self goBack]; | |
| 196 | - } | |
| 197 | -} | |
| 198 | - | |
| 199 | 192 | #pragma mark - Action |
| 200 | 193 | - (void)goBack { |
| 201 | 194 | if (self.presentingViewController != nil) { |
| ... | ... | @@ -207,13 +200,18 @@ |
| 207 | 200 | } |
| 208 | 201 | |
| 209 | 202 | #pragma mark - Lazy loading |
| 210 | -- (CNLiveSettingNavigationBar *)navigationBar { | |
| 203 | +- (CNLiveNavigationBar *)navigationBar { | |
| 211 | 204 | if (!_navigationBar) { |
| 212 | - _navigationBar = [[CNLiveSettingNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)]; | |
| 213 | - _navigationBar.backgroundColor = [UIColor whiteColor]; | |
| 214 | - _navigationBar.delegate = self; | |
| 205 | + _navigationBar = [CNLiveNavigationBar navigationBar]; | |
| 215 | 206 | _navigationBar.title.text = @"隐私"; |
| 216 | - _navigationBar.right = nil; | |
| 207 | + | |
| 208 | + __weak typeof(self) weakSelf = self; | |
| 209 | + _navigationBar.onClickLeftButton = ^{ | |
| 210 | + __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 211 | + if(!strongSelf) return ; | |
| 212 | + [strongSelf goBack]; | |
| 213 | + }; | |
| 214 | + | |
| 217 | 215 | } |
| 218 | 216 | return _navigationBar; |
| 219 | 217 | } | ... | ... |
CNLiveSettingModule/Classes/UpdateTel/CNLiveUpdateTelController.m
| ... | ... | @@ -18,12 +18,12 @@ |
| 18 | 18 | #import "CNLiveCategory.h" |
| 19 | 19 | #import "CNLiveBaseKit.h" |
| 20 | 20 | |
| 21 | -#import "CNLiveSettingNavigationBar.h" | |
| 21 | +#import "CNLiveNavigationBar.h" | |
| 22 | 22 | #import "CNLiveUpdateTelView.h" |
| 23 | 23 | |
| 24 | -@interface CNLiveUpdateTelController()<UITextFieldDelegate, CNLiveSettingNavigationBarDelegate, CNLiveUpdateTelViewDelegate, ChooseCountriesDelegate> | |
| 24 | +@interface CNLiveUpdateTelController()<UITextFieldDelegate, CNLiveUpdateTelViewDelegate, ChooseCountriesDelegate> | |
| 25 | 25 | |
| 26 | -@property (nonatomic, strong) CNLiveSettingNavigationBar *navigationBar; | |
| 26 | +@property (nonatomic, strong) CNLiveNavigationBar *navigationBar; | |
| 27 | 27 | @property (nonatomic, strong) CNLiveUpdateTelView *updateTel;//背景 |
| 28 | 28 | @property (nonatomic, strong) YYLabel *connection; |
| 29 | 29 | |
| ... | ... | @@ -55,8 +55,7 @@ static const NSInteger timeValue = 1.5; |
| 55 | 55 | __strong typeof(weakSelf) strongSelf = weakSelf; |
| 56 | 56 | if(!strongSelf) return ; |
| 57 | 57 | [strongSelf.navigationController popViewControllerAnimated:YES]; |
| 58 | - | |
| 59 | - }]; | |
| 58 | + }]; | |
| 60 | 59 | |
| 61 | 60 | QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:@"更换手机号将只能使用新绑定的手机号登录app,是否继续修改?" message:@"" preferredStyle:QMUIAlertControllerStyleAlert]; |
| 62 | 61 | [alertController addAction:sure]; |
| ... | ... | @@ -86,7 +85,7 @@ static const NSInteger timeValue = 1.5; |
| 86 | 85 | - (void)xw_layoutSubviews{ |
| 87 | 86 | [self.updateTel mas_makeConstraints:^(MASConstraintMaker *make) { |
| 88 | 87 | make.left.right.equalTo(self.view); |
| 89 | - make.top.equalTo(self.view).offset(NavigationContentTop+1); | |
| 88 | + make.top.equalTo(self.view).offset(NavigationContentTop); | |
| 90 | 89 | make.height.mas_equalTo(220); |
| 91 | 90 | }]; |
| 92 | 91 | [self.connection mas_makeConstraints:^(MASConstraintMaker *make) { |
| ... | ... | @@ -126,13 +125,17 @@ static const NSInteger timeValue = 1.5; |
| 126 | 125 | } |
| 127 | 126 | |
| 128 | 127 | #pragma mark - Lazy Loading |
| 129 | -- (CNLiveSettingNavigationBar *)navigationBar { | |
| 128 | +- (CNLiveNavigationBar *)navigationBar { | |
| 130 | 129 | if (!_navigationBar) { |
| 131 | - _navigationBar = [[CNLiveSettingNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)]; | |
| 132 | - _navigationBar.backgroundColor = [UIColor whiteColor]; | |
| 133 | - _navigationBar.delegate = self; | |
| 130 | + _navigationBar = [CNLiveNavigationBar navigationBar]; | |
| 134 | 131 | _navigationBar.title.text = @"更换手机号"; |
| 135 | - _navigationBar.right = nil; | |
| 132 | + __weak typeof(self) weakSelf = self; | |
| 133 | + _navigationBar.onClickLeftButton = ^{ | |
| 134 | + __strong typeof(weakSelf) strongSelf = weakSelf; | |
| 135 | + if(!strongSelf) return ; | |
| 136 | + [strongSelf.navigationController popViewControllerAnimated:YES]; | |
| 137 | + }; | |
| 138 | + | |
| 136 | 139 | } |
| 137 | 140 | return _navigationBar; |
| 138 | 141 | } |
| ... | ... | @@ -203,13 +206,4 @@ static const NSInteger timeValue = 1.5; |
| 203 | 206 | } |
| 204 | 207 | */ |
| 205 | 208 | |
| 206 | -#pragma mark - CNLiveSettingNavigationBarDelegate | |
| 207 | -- (void)navigationBar:(CNLiveSettingNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{ | |
| 208 | - if ([actionEvents isEqualToString:@"1"]) { | |
| 209 | - [self.navigationController popViewControllerAnimated:YES]; | |
| 210 | - }else if ([actionEvents isEqualToString:@"2"]){ | |
| 211 | - | |
| 212 | - } | |
| 213 | -} | |
| 214 | - | |
| 215 | 209 | @end | ... | ... |
CNLiveSettingModule/Classes/View/CNLiveSettingNavigationBar.h deleted
100644 → 0
| 1 | -// | |
| 2 | -// CNLiveSettingNavigationBar.m | |
| 3 | -// CNLiveSettingModule | |
| 4 | -// | |
| 5 | -// Created by 153993236@qq.com on 11/12/2019. | |
| 6 | -// Copyright (c) 2019 153993236@qq.com. All rights reserved. | |
| 7 | -// | |
| 8 | - | |
| 9 | -#import <UIKit/UIKit.h> | |
| 10 | - | |
| 11 | -NS_ASSUME_NONNULL_BEGIN | |
| 12 | -@class CNLiveSettingNavigationBar; | |
| 13 | - | |
| 14 | -@protocol CNLiveSettingNavigationBarDelegate <NSObject> | |
| 15 | -- (void)navigationBar:(CNLiveSettingNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents; | |
| 16 | - | |
| 17 | -@end | |
| 18 | - | |
| 19 | -@interface CNLiveSettingNavigationBar : UIView | |
| 20 | -@property (nonatomic, weak) id<CNLiveSettingNavigationBarDelegate> delegate; | |
| 21 | -@property (nonatomic, strong) UIView *navView; | |
| 22 | -@property (nonatomic, strong) UIButton *left; | |
| 23 | -@property (nonatomic, strong) UILabel *title; | |
| 24 | -@property (nonatomic, strong, nullable) UIButton *right; | |
| 25 | - | |
| 26 | - | |
| 27 | -@end | |
| 28 | - | |
| 29 | -NS_ASSUME_NONNULL_END |
CNLiveSettingModule/Classes/View/CNLiveSettingNavigationBar.m deleted
100644 → 0
| 1 | -// | |
| 2 | -// CNLiveSettingNavigationBar.m | |
| 3 | -// CNLiveSettingModule | |
| 4 | -// | |
| 5 | -// Created by 153993236@qq.com on 11/12/2019. | |
| 6 | -// Copyright © 2019 153993236@qq.com. All rights reserved. | |
| 7 | -// | |
| 8 | - | |
| 9 | -#import "CNLiveSettingNavigationBar.h" | |
| 10 | -#import "QMUIKit.h" | |
| 11 | -#import "CNLiveCategory.h" | |
| 12 | - | |
| 13 | -@interface CNLiveSettingNavigationBar () | |
| 14 | - | |
| 15 | -@end | |
| 16 | - | |
| 17 | -@implementation CNLiveSettingNavigationBar | |
| 18 | -static const NSInteger margin = 15; | |
| 19 | - | |
| 20 | -- (instancetype)initWithFrame:(CGRect)frame{ | |
| 21 | - self = [super initWithFrame:frame]; | |
| 22 | - if(self){ | |
| 23 | - self.userInteractionEnabled = YES; | |
| 24 | - self.backgroundColor = [UIColor clearColor]; | |
| 25 | - [self createSubViews]; | |
| 26 | - } | |
| 27 | - return self; | |
| 28 | -} | |
| 29 | - | |
| 30 | -- (void)dealloc { | |
| 31 | - NSLog(@"CNLiveSettingNavigationBar -- dealloc"); | |
| 32 | -} | |
| 33 | - | |
| 34 | -- (void)createSubViews { | |
| 35 | - [self addSubview:self.navView]; | |
| 36 | - [self addSubview:self.left]; | |
| 37 | - [self addSubview:self.title]; | |
| 38 | - [self addSubview:self.right]; | |
| 39 | -} | |
| 40 | - | |
| 41 | -/* | |
| 42 | - // Only override drawRect: if you perform custom drawing. | |
| 43 | - // An empty implementation adversely affects performance during animation. | |
| 44 | - - (void)drawRect:(CGRect)rect { | |
| 45 | - // Drawing code | |
| 46 | - } | |
| 47 | - */ | |
| 48 | - | |
| 49 | -#pragma mark - 懒加载 | |
| 50 | -- (UIView *)navView { | |
| 51 | - if (!_navView) { | |
| 52 | - _navView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, NavigationContentTop)]; | |
| 53 | - _navView.backgroundColor = [UIColor clearColor]; | |
| 54 | - } | |
| 55 | - return _navView; | |
| 56 | -} | |
| 57 | - | |
| 58 | -- (UIButton *)left { | |
| 59 | - if (!_left) { | |
| 60 | - _left= [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 61 | - _left.adjustsImageWhenHighlighted = NO; | |
| 62 | - _left.frame = CGRectMake(margin, StatusBarHeight, NavigationBarHeight, NavigationBarHeight); | |
| 63 | - UIImage *image = [self getImageWithImageName:@"mine_back_black_b" bundleName:@"CNLiveSettingModule" targetClass:[CNLiveSettingNavigationBar class]]; | |
| 64 | - [_left setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal]; | |
| 65 | - _left.titleLabel.font = [UIFont systemFontOfSize:15]; | |
| 66 | - [_left setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft]; | |
| 67 | - [_left addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside]; | |
| 68 | - } | |
| 69 | - return _left; | |
| 70 | -} | |
| 71 | - | |
| 72 | -- (UILabel *)title { | |
| 73 | - if (!_title) { | |
| 74 | - _title = [[UILabel alloc] initWithFrame:CGRectMake(margin+NavigationBarHeight, StatusBarHeight, SCREEN_WIDTH-2*(margin+NavigationBarHeight), NavigationBarHeight)]; | |
| 75 | - [_title setFont:[UIFont systemFontOfSize:18]]; | |
| 76 | - _title.textColor = [UIColor blackColor]; | |
| 77 | - _title.textAlignment = NSTextAlignmentCenter; | |
| 78 | - } | |
| 79 | - return _title; | |
| 80 | -} | |
| 81 | - | |
| 82 | -- (UIButton *)right { | |
| 83 | - if (!_right) { | |
| 84 | - _right = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 85 | - _right.frame = CGRectMake(SCREEN_WIDTH-NavigationBarHeight-margin, StatusBarHeight, NavigationBarHeight, NavigationBarHeight); | |
| 86 | - [_right setContentHorizontalAlignment:UIControlContentHorizontalAlignmentRight]; | |
| 87 | - _right.adjustsImageWhenHighlighted = NO; | |
| 88 | - _right.titleLabel.font = [UIFont systemFontOfSize:15]; | |
| 89 | - [_right setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | |
| 90 | - [_right addTarget:self action:@selector(rightDidClicked:) forControlEvents:UIControlEventTouchUpInside]; | |
| 91 | - } | |
| 92 | - return _right; | |
| 93 | -} | |
| 94 | - | |
| 95 | -#pragma mark - 响应方法 | |
| 96 | -- (void)goBack{ | |
| 97 | - if (self.delegate && [self.delegate respondsToSelector:@selector(navigationBar:actionEvents:)]) { | |
| 98 | - [self.delegate navigationBar:self actionEvents:@"1"]; | |
| 99 | - } | |
| 100 | -} | |
| 101 | -- (void)rightDidClicked:(UIButton *)btn{ | |
| 102 | - if (self.delegate && [self.delegate respondsToSelector:@selector(navigationBar:actionEvents:)]) { | |
| 103 | - [self.delegate navigationBar:self actionEvents:@"2"]; | |
| 104 | - } | |
| 105 | -} | |
| 106 | - | |
| 107 | -@end |
Example/CNLiveSettingModule.xcodeproj/project.pbxproj
| ... | ... | @@ -360,6 +360,7 @@ |
| 360 | 360 | "${BUILT_PRODUCTS_DIR}/CNLiveChooseCountry/CNLiveChooseCountry.framework", |
| 361 | 361 | "${BUILT_PRODUCTS_DIR}/CNLiveCommonCategory/CNLiveCommonCategory.framework", |
| 362 | 362 | "${BUILT_PRODUCTS_DIR}/CNLiveCommonClass/CNLiveCommonClass.framework", |
| 363 | + "${BUILT_PRODUCTS_DIR}/CNLiveCustomControl/CNLiveCustomControl.framework", | |
| 363 | 364 | "${BUILT_PRODUCTS_DIR}/CNLiveEnvironment/CNLiveEnvironment.framework", |
| 364 | 365 | "${BUILT_PRODUCTS_DIR}/CNLiveImagePickerController/CNLiveImagePickerController.framework", |
| 365 | 366 | "${BUILT_PRODUCTS_DIR}/CNLiveManager/CNLiveManager.framework", |
| ... | ... | @@ -389,6 +390,7 @@ |
| 389 | 390 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveChooseCountry.framework", |
| 390 | 391 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonCategory.framework", |
| 391 | 392 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonClass.framework", |
| 393 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCustomControl.framework", | |
| 392 | 394 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveEnvironment.framework", |
| 393 | 395 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveImagePickerController.framework", |
| 394 | 396 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveManager.framework", | ... | ... |