Commit 7f46d610432580dfe1feb9d5b67d0058e69409c7
1 parent
b59bd700
提交Ui完成和交互完成
Showing
12 changed files
with
609 additions
and
49 deletions
CNLiveOrganizationValidationModule/Assets/CNLiveOrganizationValidationModule.bundle/organization_normal@2x.png
0 → 100644
461 Bytes
CNLiveOrganizationValidationModule/Assets/CNLiveOrganizationValidationModule.bundle/organization_normal@3x.png
0 → 100644
818 Bytes
CNLiveOrganizationValidationModule/Classes/CNLiveOrganizationValidationModule/Controller/CNLiveBAgreementContentController.m
CNLiveOrganizationValidationModule/Classes/CNLiveOrganizationValidationModule/Controller/CNLiveBOrganizationValidattionController.m
| ... | ... | @@ -11,9 +11,16 @@ |
| 11 | 11 | #import "CNLiveBOrganizationValidationHeaderView.h" |
| 12 | 12 | #import "CNLiveBOrganizationContentCell.h" |
| 13 | 13 | #import "CNLiveBAgreementCommitFinishController.h" |
| 14 | +#import "CNLiveBAgreementContentController.h" | |
| 14 | 15 | #import "CNLiveBOrganizationPopSelectedView.h" |
| 15 | - | |
| 16 | -@interface CNLiveBOrganizationValidattionController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate,UITextViewDelegate>{ | |
| 16 | +#import "CNLiveBOrganizationPhotoSelectedView.h" | |
| 17 | +#import <CNLiveImagePickerController/CNImagePickerController.h> | |
| 18 | +#import <RSKImageCropper/RSKImageCropper.h> | |
| 19 | +#import <QMUIKit/QMUIKit.h> | |
| 20 | +#import <YYKit/YYKit.h> | |
| 21 | +#import <objc/runtime.h> | |
| 22 | + | |
| 23 | +@interface CNLiveBOrganizationValidattionController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate,UITextViewDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate,TZImagePickerControllerDelegate, RSKImageCropViewControllerDelegate,RSKImageCropViewControllerDataSource>{ | |
| 17 | 24 | CGPoint contentoffset; |
| 18 | 25 | } |
| 19 | 26 | |
| ... | ... | @@ -28,6 +35,11 @@ |
| 28 | 35 | /** 弹出视图*/ |
| 29 | 36 | @property (nonatomic , strong) CNLiveBOrganizationPopSelectedView *popSelectedView; |
| 30 | 37 | |
| 38 | +/** 相册弹出实体图*/ | |
| 39 | +@property (nonatomic , strong) CNLiveBOrganizationPhotoSelectedView *photoSelecctedView; | |
| 40 | + | |
| 41 | +@property (nonatomic, strong) UIImagePickerController *pickerVC; | |
| 42 | + | |
| 31 | 43 | |
| 32 | 44 | @end |
| 33 | 45 | |
| ... | ... | @@ -84,7 +96,18 @@ |
| 84 | 96 | self.footerView.clickCommitButtonBlock = ^(CNLiveBOrganizationTVFooteriew * _Nonnull footerView, UIButton * _Nonnull commitBtn) { |
| 85 | 97 | [weakSelf jumpCommitVC]; |
| 86 | 98 | }; |
| 99 | + self.footerView.clickAgreementButtonBlock = ^(CNLiveBOrganizationTVFooteriew * _Nonnull footerView, UIButton * _Nonnull agreementBtn) { | |
| 100 | + footerView.agreementBtn.selected = ! footerView.agreementBtn.selected; | |
| 101 | +#pragma mark - TODO: 记录内容 | |
| 102 | + | |
| 103 | + }; | |
| 104 | + self.footerView.clickAgreementLBlock = ^(CNLiveBOrganizationTVFooteriew * _Nonnull footerView, UILabel * _Nonnull agreementL) { | |
| 105 | + [weakSelf jumpContentVC]; | |
| 106 | + | |
| 107 | + }; | |
| 87 | 108 | |
| 109 | + self.pickerVC = [[UIImagePickerController alloc] init]; | |
| 110 | + self.pickerVC.delegate = self; | |
| 88 | 111 | } |
| 89 | 112 | |
| 90 | 113 | #pragma mark - |
| ... | ... | @@ -107,12 +130,12 @@ |
| 107 | 130 | //获取当前cell在tableview中的位置 |
| 108 | 131 | CGRect rectInTableview = [self.tableView rectForRowAtIndexPath:indexpath]; |
| 109 | 132 | //获取当前cell在屏幕中的位置 |
| 110 | -// CGRect rectInSuperview = [self.tableView convertRect:rectInTableview fromView:self.tableView.superview]; | |
| 133 | + // CGRect rectInSuperview = [self.tableView convertRect:rectInTableview fromView:self.tableView.superview]; | |
| 111 | 134 | contentoffset.x = self.tableView.contentOffset.x; |
| 112 | 135 | contentoffset.y = self.tableView.contentOffset.y; |
| 113 | 136 | if ((rectInTableview.origin.y+50-self.tableView.contentOffset.y)>200) { |
| 114 | 137 | [self.tableView setContentOffset:CGPointMake(self.tableView.contentOffset.x,((rectInTableview.origin.y-self.tableView.contentOffset.y)-150)+self.tableView.contentOffset.y) animated:YES]; |
| 115 | - | |
| 138 | + | |
| 116 | 139 | } |
| 117 | 140 | |
| 118 | 141 | } |
| ... | ... | @@ -132,12 +155,12 @@ |
| 132 | 155 | //获取当前cell在tableview中的位置 |
| 133 | 156 | CGRect rectInTableview = [self.tableView rectForRowAtIndexPath:indexpath]; |
| 134 | 157 | //获取当前cell在屏幕中的位置 |
| 135 | -// CGRect rectInSuperview = [self.tableView convertRect:rectInTableview fromView:self.tableView.superview]; | |
| 158 | + // CGRect rectInSuperview = [self.tableView convertRect:rectInTableview fromView:self.tableView.superview]; | |
| 136 | 159 | contentoffset.x = self.tableView.contentOffset.x; |
| 137 | 160 | contentoffset.y = self.tableView.contentOffset.y; |
| 138 | 161 | if ((rectInTableview.origin.y+50-self.tableView.contentOffset.y)>200) { |
| 139 | 162 | [self.tableView setContentOffset:CGPointMake(self.tableView.contentOffset.x,((rectInTableview.origin.y-self.tableView.contentOffset.y)-150)+self.tableView.contentOffset.y) animated:YES]; |
| 140 | - | |
| 163 | + | |
| 141 | 164 | } |
| 142 | 165 | |
| 143 | 166 | } |
| ... | ... | @@ -219,7 +242,7 @@ |
| 219 | 242 | - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { |
| 220 | 243 | |
| 221 | 244 | if (section == 0) { |
| 222 | - return [UIView new]; | |
| 245 | + return [UIView new]; | |
| 223 | 246 | |
| 224 | 247 | }else { |
| 225 | 248 | return [UIView new]; |
| ... | ... | @@ -241,7 +264,7 @@ |
| 241 | 264 | }else { |
| 242 | 265 | return 44; |
| 243 | 266 | } |
| 244 | - | |
| 267 | + | |
| 245 | 268 | }else { |
| 246 | 269 | return 80; |
| 247 | 270 | } |
| ... | ... | @@ -271,11 +294,221 @@ |
| 271 | 294 | /** 点击cell实现 */ |
| 272 | 295 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { |
| 273 | 296 | |
| 297 | + if (indexPath.section == 0) { | |
| 298 | + if (indexPath.row == 1) { | |
| 299 | + [self.photoSelecctedView popViewForView:self.view]; | |
| 300 | + __weak typeof(self) weakSelf = self; | |
| 301 | + self.photoSelecctedView.clickViewBlock = ^(CNLiveBOrganizationPhotoSelectedView * _Nonnull view, NSInteger indexCount) { | |
| 302 | + | |
| 303 | + [weakSelf checkPermissionsWithCount:indexCount type:0]; | |
| 304 | + | |
| 305 | + }; | |
| 306 | + | |
| 307 | + | |
| 308 | + }else if (indexPath.row == 12){ | |
| 309 | + | |
| 310 | + [self.photoSelecctedView popViewForView:self.view]; | |
| 311 | + __weak typeof(self) weakSelf = self; | |
| 312 | + self.photoSelecctedView.clickViewBlock = ^(CNLiveBOrganizationPhotoSelectedView * _Nonnull view, NSInteger indexCount) { | |
| 313 | + [weakSelf checkPermissionsWithCount:indexCount type:1]; | |
| 314 | + | |
| 315 | + }; | |
| 316 | + | |
| 317 | + } | |
| 318 | + } | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | +} | |
| 323 | + | |
| 324 | +#pragma mark - RSKImageCropViewControllerDelegate | |
| 325 | +- (void)imageCropViewController:(RSKImageCropViewController *)controller didCropImage:(UIImage *)croppedImage usingCropRect:(CGRect)cropRect rotationAngle:(CGFloat)rotationAngle { | |
| 326 | + NSLog(@"%@",croppedImage); | |
| 327 | + | |
| 328 | +#pragma mark - TODO: 获取图片 | |
| 329 | + if (self.navigationController) { | |
| 330 | + [self.navigationController popViewControllerAnimated:YES]; | |
| 331 | + } | |
| 332 | +} | |
| 333 | + | |
| 334 | +- (void)imageCropViewControllerDidCancelCrop:(RSKImageCropViewController *)controller { | |
| 335 | + NSLog(@"取消"); | |
| 336 | + if (self.navigationController) { | |
| 337 | + [self.navigationController popViewControllerAnimated:YES]; | |
| 338 | + } | |
| 339 | + | |
| 340 | +} | |
| 341 | + | |
| 342 | +#pragma mark - RSKImageCropViewControllerDataSource | |
| 343 | +- (CGRect)imageCropViewControllerCustomMaskRect:(RSKImageCropViewController *)controller { | |
| 344 | + //返回所截取图片的位置 | |
| 345 | + return CGRectMake(0, (KScreenHeight-KScreenWidth)/2, KScreenWidth, KScreenWidth); | |
| 346 | +} | |
| 347 | + | |
| 348 | +- (UIBezierPath *)imageCropViewControllerCustomMaskPath:(RSKImageCropViewController *)controller { | |
| 349 | + //返回裁剪框的位置 | |
| 350 | + UIBezierPath *path=[UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, (KScreenHeight-KScreenWidth)/2, KScreenWidth, KScreenWidth) cornerRadius:0]; | |
| 351 | + return path; | |
| 352 | +} | |
| 353 | + | |
| 354 | +- (CGRect)imageCropViewControllerCustomMovementRect:(RSKImageCropViewController *)controller { | |
| 355 | + //返回图片可移动的框框大小 | |
| 356 | + return CGRectMake(0, (KScreenHeight-KScreenWidth)/2, KScreenWidth, KScreenWidth); | |
| 357 | +} | |
| 358 | + | |
| 359 | +#pragma mark - UIImagePickerControllerDelegate | |
| 360 | +- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { | |
| 361 | + | |
| 362 | + NSString *type = [info objectForKey:UIImagePickerControllerMediaType]; | |
| 363 | + | |
| 364 | + //当选择的类型是图片 | |
| 365 | + if ([type isEqualToString:@"public.image"])//@"public.image" | |
| 366 | + { | |
| 367 | + NSString *key = nil; | |
| 368 | + | |
| 369 | + if (picker.allowsEditing) { | |
| 370 | + key = UIImagePickerControllerEditedImage; | |
| 371 | + } | |
| 372 | + else { | |
| 373 | + key = UIImagePickerControllerOriginalImage; | |
| 374 | + } | |
| 375 | + //获取图片 | |
| 376 | + UIImage *image = [info objectForKey:key]; | |
| 377 | +#pragma mark - TODO:获取图片 | |
| 378 | + //关闭相册界面 | |
| 379 | + [picker dismissViewControllerAnimated:YES completion:^{ | |
| 380 | + | |
| 381 | + }]; | |
| 382 | + } | |
| 383 | +} | |
| 384 | + | |
| 385 | + | |
| 386 | +//当用户取消选择的时候,调用该方法 | |
| 387 | +- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { | |
| 388 | + [picker dismissViewControllerAnimated:YES completion:^{}]; | |
| 389 | +} | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | +#pragma mark - ***私有方法*** | |
| 396 | +///检查拍照权限 | |
| 397 | +- (void)checkPermissionsWithCount:(NSInteger)indexCount type:(NSInteger)type { | |
| 398 | + AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]; | |
| 399 | + if ((authStatus == AVAuthorizationStatusRestricted || authStatus ==AVAuthorizationStatusDenied) && kiOS7Later) { | |
| 400 | + // 无权限 做一个友好的提示 | |
| 401 | + | |
| 402 | + [self goPrivacySetting]; | |
| 403 | + } else if (authStatus == AVAuthorizationStatusNotDetermined) { | |
| 404 | + // fix issue 466, 防止用户首次拍照拒绝授权时相机页黑屏 | |
| 405 | + if (kiOS7Later) { | |
| 406 | + [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) { | |
| 407 | + if (granted) { | |
| 408 | + dispatch_sync(dispatch_get_main_queue(), ^{ | |
| 409 | + [self jumpPhotoWithCount:indexCount type:type]; | |
| 410 | + }); | |
| 411 | + } | |
| 412 | + }]; | |
| 413 | + } else { | |
| 414 | + [self jumpPhotoWithCount:indexCount type:type]; | |
| 415 | + } | |
| 416 | + } else { | |
| 417 | + [self jumpPhotoWithCount:indexCount type:type]; | |
| 418 | + } | |
| 419 | +} | |
| 420 | + | |
| 421 | +- (void)goPrivacySetting { | |
| 422 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
| 423 | + NSString *appName = [[NSBundle mainBundle].infoDictionary valueForKey:@"CFBundleDisplayName"]; | |
| 424 | + if (!appName) appName = [[NSBundle mainBundle].infoDictionary valueForKey:@"CFBundleName"]; | |
| 425 | + NSString *message = [NSString stringWithFormat:@"请去-> [设置 - 隐私 - 相机 - %@] 打开访问开关",appName]; | |
| 426 | + | |
| 427 | + QMUIAlertAction *action1 = [QMUIAlertAction actionWithTitle:@"确定" style:QMUIAlertActionStyleCancel handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) { | |
| 428 | + | |
| 429 | + }]; | |
| 430 | + QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:@"警告" message:message preferredStyle:QMUIAlertControllerStyleAlert]; | |
| 431 | + [alertController addAction:action1]; | |
| 432 | + [alertController showWithAnimated:YES]; | |
| 433 | + | |
| 434 | + }); | |
| 435 | +} | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | +/// 跳转相册,相机 | |
| 440 | +- (void)jumpPhotoWithCount:(NSInteger)indexCount type:(NSInteger) type { | |
| 441 | + | |
| 442 | + if (type == 0) { | |
| 443 | + if (indexCount == 0) { | |
| 444 | + if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { | |
| 445 | + self.pickerVC.sourceType = UIImagePickerControllerSourceTypeCamera; | |
| 446 | + //设置拍照后的图片可被编辑 | |
| 447 | + self.pickerVC.modalPresentationStyle = UIModalPresentationFullScreen; | |
| 448 | + self.pickerVC.allowsEditing = YES; | |
| 449 | + [self presentViewController:self.pickerVC animated:YES completion:nil]; | |
| 450 | + | |
| 451 | + } | |
| 452 | + | |
| 453 | + } else if (indexCount == 1) { | |
| 454 | + TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:self]; | |
| 455 | + imagePickerVc.modalPresentationStyle = UIModalPresentationFullScreen; | |
| 456 | + imagePickerVc.allowTakePicture = NO; // 在内部显示拍照按钮 | |
| 457 | + imagePickerVc.allowPreview = NO; | |
| 458 | + imagePickerVc.allowPickingOriginalPhoto = NO; | |
| 459 | + imagePickerVc.allowPickingVideo = NO; | |
| 460 | + | |
| 461 | + [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) { | |
| 462 | + UIImage *image = photos.firstObject; | |
| 463 | + // weakSelf.prepareImage = image; | |
| 464 | + RSKImageCropViewController *imageCropVC = [[RSKImageCropViewController alloc] initWithImage:image cropMode:RSKImageCropModeCustom];//传入图片与裁剪框的类型 RSKImageCropModeCustom RSKImageCropModeSquare | |
| 465 | + imageCropVC.delegate = self; | |
| 466 | + imageCropVC.dataSource = self; | |
| 467 | + imageCropVC.maskLayerStrokeColor = kWhiteColor; | |
| 468 | + imageCropVC.avoidEmptySpaceAroundImage = YES; | |
| 469 | + [self.navigationController pushViewController:imageCropVC animated:YES]; | |
| 470 | + }]; | |
| 471 | + [self presentViewController:imagePickerVc animated:YES completion:nil]; | |
| 472 | + return; | |
| 473 | + | |
| 474 | + } | |
| 475 | + }else { | |
| 476 | + if (indexCount == 0) { | |
| 477 | + if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { | |
| 478 | + self.pickerVC.sourceType = UIImagePickerControllerSourceTypeCamera; | |
| 479 | + //设置拍照后的图片可被编辑 | |
| 480 | + self.pickerVC.modalPresentationStyle = UIModalPresentationFullScreen; | |
| 481 | + self.pickerVC.allowsEditing = NO; | |
| 482 | + [self presentViewController:self.pickerVC animated:YES completion:nil]; | |
| 483 | + | |
| 484 | + } | |
| 485 | + | |
| 486 | + } else if (indexCount == 1) { | |
| 487 | + TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:self]; | |
| 488 | + imagePickerVc.modalPresentationStyle = UIModalPresentationFullScreen; | |
| 489 | + imagePickerVc.allowTakePicture = NO; // 在内部显示拍照按钮 | |
| 490 | + imagePickerVc.allowPreview = NO; | |
| 491 | + imagePickerVc.allowPickingOriginalPhoto = NO; | |
| 492 | + imagePickerVc.allowPickingVideo = NO; | |
| 493 | + | |
| 494 | + [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) { | |
| 495 | + UIImage *image = photos.firstObject; | |
| 496 | + | |
| 497 | + }]; | |
| 498 | + [self presentViewController:imagePickerVc animated:YES completion:nil]; | |
| 499 | + return; | |
| 500 | + | |
| 501 | + } | |
| 502 | + | |
| 503 | + } | |
| 504 | + | |
| 274 | 505 | |
| 275 | 506 | |
| 276 | 507 | } |
| 277 | 508 | |
| 278 | 509 | |
| 510 | + | |
| 511 | + | |
| 279 | 512 | #pragma mark - TODO: |
| 280 | 513 | #pragma mark - *** 事件实现 *** |
| 281 | 514 | |
| ... | ... | @@ -284,7 +517,12 @@ |
| 284 | 517 | [self.navigationController pushViewController:commitVC animated:YES]; |
| 285 | 518 | } |
| 286 | 519 | |
| 287 | - | |
| 520 | +- (void)jumpContentVC { | |
| 521 | + CNLiveBAgreementContentController *contentVC = [[CNLiveBAgreementContentController alloc] init]; | |
| 522 | + [self.navigationController pushViewController:contentVC animated:YES]; | |
| 523 | +} | |
| 524 | + | |
| 525 | + | |
| 288 | 526 | - (void)popView { |
| 289 | 527 | |
| 290 | 528 | [self.popSelectedView popViewForView:self.view]; |
| ... | ... | @@ -293,8 +531,8 @@ |
| 293 | 531 | |
| 294 | 532 | |
| 295 | 533 | }; |
| 296 | - | |
| 297 | - | |
| 534 | + | |
| 535 | + | |
| 298 | 536 | } |
| 299 | 537 | |
| 300 | 538 | |
| ... | ... | @@ -346,6 +584,13 @@ |
| 346 | 584 | return _popSelectedView;; |
| 347 | 585 | } |
| 348 | 586 | |
| 587 | +- (CNLiveBOrganizationPhotoSelectedView *)photoSelecctedView { | |
| 588 | + if (!_photoSelecctedView) { | |
| 589 | + _photoSelecctedView = [[CNLiveBOrganizationPhotoSelectedView alloc]initWithFrame:CGRectZero]; | |
| 590 | + } | |
| 591 | + return _photoSelecctedView; | |
| 592 | +} | |
| 593 | + | |
| 349 | 594 | |
| 350 | 595 | /* |
| 351 | 596 | #pragma mark - Navigation | ... | ... |
CNLiveOrganizationValidationModule/Classes/CNLiveOrganizationValidationModule/Other/CNLiveBOrganizationImageView.m
| ... | ... | @@ -6,6 +6,9 @@ |
| 6 | 6 | // |
| 7 | 7 | |
| 8 | 8 | #import "CNLiveBOrganizationImageView.h" |
| 9 | +#import <Masonry/Masonry.h> | |
| 10 | +#import "UIImage+OrganizationValidation.h" | |
| 11 | +#import <CNLiveBaseKit/CNLiveBaseKit.h> | |
| 9 | 12 | |
| 10 | 13 | @implementation CNLiveBOrganizationImageView |
| 11 | 14 | |
| ... | ... | @@ -30,11 +33,32 @@ |
| 30 | 33 | |
| 31 | 34 | - (void)setUpUI |
| 32 | 35 | { |
| 36 | + self.layer.cornerRadius = 5; | |
| 37 | + self.layer.masksToBounds = YES; | |
| 38 | + | |
| 39 | + [self addSubview:self.tipLabel]; | |
| 40 | + self.tipLabel.frame = CGRectMake(0, self.frame.size.height - 19, self.frame.size.width, 19); | |
| 33 | 41 | |
| 34 | 42 | |
| 35 | 43 | } |
| 36 | 44 | |
| 37 | 45 | |
| 46 | +/*** 头部 ***/ | |
| 47 | +- (UILabel *)tipLabel { | |
| 48 | + | |
| 49 | + if (!_tipLabel) { | |
| 50 | + _tipLabel = [[UILabel alloc]init]; | |
| 51 | + _tipLabel.font = [UIFont systemFontOfSize:12]; | |
| 52 | + _tipLabel.numberOfLines = 1; | |
| 53 | + _tipLabel.textColor = [UIColor whiteColor]; | |
| 54 | + _tipLabel.text = @"更改"; | |
| 55 | + _tipLabel.backgroundColor = [UIColor blackColor]; | |
| 56 | + _tipLabel.textAlignment = NSTextAlignmentCenter; | |
| 57 | + } | |
| 58 | + return _tipLabel; | |
| 59 | + | |
| 60 | +} | |
| 61 | + | |
| 38 | 62 | |
| 39 | 63 | |
| 40 | 64 | @end | ... | ... |
CNLiveOrganizationValidationModule/Classes/CNLiveOrganizationValidationModule/Other/CNLiveBOrganizationPhotoSelectedView.h
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveBOrganizationPhotoSelectedView.h | |
| 3 | +// CNLiveOrganizationValidationModule | |
| 4 | +// | |
| 5 | +// Created by 梁星国 on 2020/4/14. | |
| 6 | +// | |
| 7 | + | |
| 8 | +#import <UIKit/UIKit.h> | |
| 9 | + | |
| 10 | +NS_ASSUME_NONNULL_BEGIN | |
| 11 | + | |
| 12 | +@interface CNLiveBOrganizationPhotoSelectedView : UIView | |
| 13 | + | |
| 14 | +/** 点击按钮l回调 */ | |
| 15 | +@property (nonatomic, copy) void(^clickViewBlock)(CNLiveBOrganizationPhotoSelectedView *view,NSInteger indexCount); | |
| 16 | + | |
| 17 | +-(void)popViewForView:(UIView *)view; | |
| 18 | + | |
| 19 | +-(void)dismissView; | |
| 20 | + | |
| 21 | + | |
| 22 | +@end | |
| 23 | + | |
| 24 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveOrganizationValidationModule/Classes/CNLiveOrganizationValidationModule/Other/CNLiveBOrganizationPhotoSelectedView.m
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveBOrganizationPhotoSelectedView.m | |
| 3 | +// CNLiveOrganizationValidationModule | |
| 4 | +// | |
| 5 | +// Created by 梁星国 on 2020/4/14. | |
| 6 | +// | |
| 7 | + | |
| 8 | +#import "CNLiveBOrganizationPhotoSelectedView.h" | |
| 9 | + | |
| 10 | +#import <Masonry/Masonry.h> | |
| 11 | +#import "UIImage+OrganizationValidation.h" | |
| 12 | +#import <CNLiveBaseKit/CNLiveBaseKit.h> | |
| 13 | +#import "CNLiveBOrganizationPopCell.h" | |
| 14 | + | |
| 15 | +@interface CNLiveBOrganizationPhotoSelectedView () | |
| 16 | + | |
| 17 | +@property (strong ,nonatomic) UIView *contentView; | |
| 18 | + | |
| 19 | +@property (strong ,nonatomic) UIButton *cancelBtn; | |
| 20 | + | |
| 21 | +@property (strong , nonatomic) UIButton *photoAlbumBtn; | |
| 22 | + | |
| 23 | +@property (strong , nonatomic) UIButton *takePhotoBtn; | |
| 24 | + | |
| 25 | +@end | |
| 26 | + | |
| 27 | +@implementation CNLiveBOrganizationPhotoSelectedView | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | +- (instancetype)initWithFrame:(CGRect)frame | |
| 32 | +{ | |
| 33 | + self = [super initWithFrame:frame]; | |
| 34 | + if (self) { | |
| 35 | + | |
| 36 | + [self setupUI]; | |
| 37 | + [self editUI]; | |
| 38 | + | |
| 39 | + } | |
| 40 | + return self; | |
| 41 | +} | |
| 42 | + | |
| 43 | +- (void)awakeFromNib { | |
| 44 | + [super awakeFromNib]; | |
| 45 | + [self setupUI]; | |
| 46 | + | |
| 47 | +} | |
| 48 | + | |
| 49 | +- (void)layoutSubviews { | |
| 50 | + [super layoutSubviews]; | |
| 51 | + | |
| 52 | + [self layoutUI]; | |
| 53 | +} | |
| 54 | + | |
| 55 | +#pragma mark - getter,setter | |
| 56 | + | |
| 57 | + | |
| 58 | +#pragma mark - setupUI | |
| 59 | +- (void)setupUI { | |
| 60 | + | |
| 61 | + self.contentView.frame = CGRectMake(0, KScreenHeight - 160-kVerticalBottomSafeHeight, KScreenWidth, 160 +kVerticalBottomSafeHeight); | |
| 62 | + [self.contentView setBackgroundColor:RGBOF(0xD8D8D8)]; | |
| 63 | + [self.contentView addSubview:self.cancelBtn]; | |
| 64 | + [self.contentView addSubview:self.photoAlbumBtn]; | |
| 65 | + [self.contentView addSubview:self.takePhotoBtn]; | |
| 66 | + | |
| 67 | + self.takePhotoBtn.frame = CGRectMake(0, 0, KScreenWidth, 50); | |
| 68 | + self.photoAlbumBtn.frame = CGRectMake(0, 51, KScreenWidth, 50); | |
| 69 | + self.cancelBtn.frame = CGRectMake(0, 111, KScreenWidth, 50); | |
| 70 | + [self.takePhotoBtn setBackgroundColor:[UIColor whiteColor]]; | |
| 71 | + [self.photoAlbumBtn setBackgroundColor:[UIColor whiteColor]]; | |
| 72 | + [self.cancelBtn setBackgroundColor:[UIColor whiteColor]]; | |
| 73 | + | |
| 74 | + | |
| 75 | + [self addSubview:self.contentView]; | |
| 76 | + | |
| 77 | + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(viewTapAction:)]; | |
| 78 | + [self addGestureRecognizer:tap]; | |
| 79 | + | |
| 80 | + [self.takePhotoBtn addTarget:self action:@selector(takePhotoBtnAction:) forControlEvents:UIControlEventTouchUpInside]; | |
| 81 | + [self.photoAlbumBtn addTarget:self action:@selector(photoAlbumBtnAction:) forControlEvents:UIControlEventTouchUpInside]; | |
| 82 | + [self.cancelBtn addTarget:self action:@selector(cancelBtnAction:) forControlEvents:UIControlEventTouchUpInside]; | |
| 83 | +} | |
| 84 | + | |
| 85 | +#pragma mark - layoutUI | |
| 86 | +- (void)layoutUI { | |
| 87 | + | |
| 88 | + | |
| 89 | +} | |
| 90 | + | |
| 91 | +#pragma mark - editUI | |
| 92 | +- (void)editUI { | |
| 93 | + | |
| 94 | +} | |
| 95 | + | |
| 96 | +#pragma mark - 事件实现 | |
| 97 | +- (void)viewTapAction:(UITapGestureRecognizer *)tap { | |
| 98 | + | |
| 99 | + [self dismissView]; | |
| 100 | +} | |
| 101 | + | |
| 102 | +- (void)takePhotoBtnAction:(UIButton *)sender { | |
| 103 | + | |
| 104 | + if (self.clickViewBlock) { | |
| 105 | + self.clickViewBlock(self, 0); | |
| 106 | + __weak typeof(self) weakSelf = self; | |
| 107 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |
| 108 | + if (weakSelf) { | |
| 109 | + [weakSelf dismissView]; | |
| 110 | + } | |
| 111 | + }); | |
| 112 | + } | |
| 113 | +} | |
| 114 | + | |
| 115 | +- (void)photoAlbumBtnAction:(UIButton *)sender { | |
| 116 | + if (self.clickViewBlock) { | |
| 117 | + self.clickViewBlock(self, 1); | |
| 118 | + __weak typeof(self) weakSelf = self; | |
| 119 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |
| 120 | + if (weakSelf) { | |
| 121 | + [weakSelf dismissView]; | |
| 122 | + } | |
| 123 | + | |
| 124 | + }); | |
| 125 | + } | |
| 126 | +} | |
| 127 | + | |
| 128 | +- (void)cancelBtnAction:(UIButton *)sender { | |
| 129 | + | |
| 130 | + if (self) { | |
| 131 | + [self dismissView]; | |
| 132 | + } | |
| 133 | +} | |
| 134 | + | |
| 135 | +#pragma mark - 私有方法 | |
| 136 | + | |
| 137 | +#pragma mark - 弹出 | |
| 138 | +-(void)popViewForView:(UIView *)view{ | |
| 139 | + | |
| 140 | + [view addSubview:self]; | |
| 141 | + [view bringSubviewToFront:self]; | |
| 142 | + self.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight); | |
| 143 | + [self setBackgroundColor:RGBA(0, 0, 0, 0.5)]; | |
| 144 | + self.alpha = 0.3; | |
| 145 | + self.contentView.frame = CGRectMake(0, KScreenHeight, KScreenWidth, 160 +kVerticalBottomSafeHeight); | |
| 146 | + | |
| 147 | + [UIView animateWithDuration:0.25 animations:^{ | |
| 148 | + self.alpha = 1.0; | |
| 149 | + | |
| 150 | + self.contentView.frame = CGRectMake(0, KScreenHeight - 160-kVerticalBottomSafeHeight, KScreenWidth, 160 +kVerticalBottomSafeHeight); | |
| 151 | + | |
| 152 | + }]; | |
| 153 | +} | |
| 154 | + | |
| 155 | +-(void)dismissView{ | |
| 156 | + | |
| 157 | + [UIView animateWithDuration:0.25 animations:^{ | |
| 158 | + self.alpha = 0.3; | |
| 159 | + self.contentView.frame = CGRectMake(0, KScreenHeight, KScreenWidth, 160 +kVerticalBottomSafeHeight); | |
| 160 | + } completion:^(BOOL finished) { | |
| 161 | + | |
| 162 | + [self removeFromSuperview]; | |
| 163 | + | |
| 164 | + }]; | |
| 165 | +} | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | +#pragma mark - 懒加载 | |
| 170 | + | |
| 171 | +- (UIView *)contentView { | |
| 172 | + if (!_contentView) { | |
| 173 | + _contentView = [[UIView alloc]initWithFrame:CGRectZero]; | |
| 174 | + } | |
| 175 | + return _contentView; | |
| 176 | +} | |
| 177 | + | |
| 178 | + | |
| 179 | +/** 取消按钮 */ | |
| 180 | +- (UIButton *)cancelBtn { | |
| 181 | + | |
| 182 | + if (!_cancelBtn) { | |
| 183 | + _cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 184 | + [_cancelBtn setTitle:@"取消" forState:UIControlStateNormal]; | |
| 185 | + [_cancelBtn setTitleColor:RGBOF(0x999999) forState:UIControlStateNormal]; | |
| 186 | + } | |
| 187 | + return _cancelBtn; | |
| 188 | +} | |
| 189 | + | |
| 190 | +/** 相册 */ | |
| 191 | +- (UIButton *)photoAlbumBtn{ | |
| 192 | + | |
| 193 | + if (!_photoAlbumBtn) { | |
| 194 | + _photoAlbumBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 195 | + [_photoAlbumBtn setTitle:@"从手机相册选择" forState:UIControlStateNormal]; | |
| 196 | + [_photoAlbumBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; | |
| 197 | + } | |
| 198 | + return _photoAlbumBtn; | |
| 199 | +} | |
| 200 | + | |
| 201 | +/** 拍照 */ | |
| 202 | +- (UIButton *)takePhotoBtn{ | |
| 203 | + | |
| 204 | + if (!_takePhotoBtn) { | |
| 205 | + _takePhotoBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 206 | + [_takePhotoBtn setTitle:@"相机" forState:UIControlStateNormal]; | |
| 207 | + [_takePhotoBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; | |
| 208 | + } | |
| 209 | + return _takePhotoBtn; | |
| 210 | +} | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | +@end | ... | ... |
CNLiveOrganizationValidationModule/Classes/CNLiveOrganizationValidationModule/Other/CNLiveBOrganizationPopSelectedView.m
| ... | ... | @@ -14,7 +14,7 @@ |
| 14 | 14 | |
| 15 | 15 | @interface CNLiveBOrganizationPopSelectedView ()<UITableViewDelegate,UITableViewDataSource> |
| 16 | 16 | { |
| 17 | - | |
| 17 | + | |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | @property (strong ,nonatomic) UIView *headerView; |
| ... | ... | @@ -43,7 +43,7 @@ |
| 43 | 43 | - (void)awakeFromNib { |
| 44 | 44 | [super awakeFromNib]; |
| 45 | 45 | [self setupUI]; |
| 46 | - | |
| 46 | + | |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | - (void)layoutSubviews { |
| ... | ... | @@ -61,22 +61,19 @@ |
| 61 | 61 | |
| 62 | 62 | [self.headerView addSubview:self.headerL]; |
| 63 | 63 | [self.headerView addSubview:self.returnBtn]; |
| 64 | - self.headerView.frame = CGRectMake(0, 0, KScreenWidth, 50); | |
| 64 | + self.headerView.frame = CGRectMake(0, KScreenHeight/2 -kVerticalBottomSafeHeight, KScreenWidth, KScreenHeight/2 + kVerticalBottomSafeHeight); | |
| 65 | + self.headerL.frame = CGRectMake(44, 0, KScreenWidth - 88, 50); | |
| 66 | + self.headerL.text = @"请选择企业类型"; | |
| 67 | + self.returnBtn.frame = CGRectMake(KScreenWidth - 54, 0, 44, 44); | |
| 68 | + [self addSubview:self.headerView]; | |
| 65 | 69 | UIBezierPath *fieldPath = [UIBezierPath bezierPathWithRoundedRect:self.headerView.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(15 , 15)]; |
| 66 | 70 | CAShapeLayer *fieldLayer = [[CAShapeLayer alloc] init]; |
| 67 | 71 | fieldLayer.frame = self.headerView.bounds; |
| 68 | 72 | fieldLayer.path = fieldPath.CGPath; |
| 69 | 73 | self.headerView.layer.mask = fieldLayer; |
| 70 | - self.headerL.frame = CGRectMake(44, 0, KScreenWidth - 88, 50); | |
| 71 | - self.headerL.text = @"请选择企业类型"; | |
| 72 | - self.returnBtn.frame = CGRectMake(KScreenWidth - 54, 0, 44, 44); | |
| 73 | - self.tableView.tableHeaderView = self.headerView; | |
| 74 | - UIView *footerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, kVerticalBottomSafeHeight)]; | |
| 75 | - self.tableView.tableFooterView = footerView; | |
| 76 | - [self.tableView setBackgroundColor:[UIColor clearColor]]; | |
| 77 | - | |
| 78 | 74 | |
| 79 | - [self addSubview:self.tableView]; | |
| 75 | + self.tableView.frame = CGRectMake(0, 50, KScreenWidth, KScreenHeight/2); | |
| 76 | + [self.headerView addSubview:self.tableView]; | |
| 80 | 77 | /** tableView */ |
| 81 | 78 | self.tableView.delegate = self; |
| 82 | 79 | self.tableView.dataSource = self; |
| ... | ... | @@ -91,15 +88,8 @@ |
| 91 | 88 | |
| 92 | 89 | #pragma mark - layoutUI |
| 93 | 90 | - (void)layoutUI { |
| 94 | - __weak typeof(self) weakSelf = self; | |
| 95 | 91 | |
| 96 | - [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 97 | - make.left.equalTo(weakSelf.mas_left); | |
| 98 | - make.top.equalTo(weakSelf.mas_top).offset(KScreenHeight/2); | |
| 99 | - make.right.equalTo(weakSelf.mas_right); | |
| 100 | - make.height.mas_equalTo(KScreenHeight/2); | |
| 101 | - }]; | |
| 102 | - | |
| 92 | + | |
| 103 | 93 | } |
| 104 | 94 | |
| 105 | 95 | #pragma mark - editUI |
| ... | ... | @@ -116,8 +106,8 @@ |
| 116 | 106 | } |
| 117 | 107 | |
| 118 | 108 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
| 119 | - CNLiveBOrganizationPopCell *cell = [tableView dequeueReusableCellWithIdentifier:kCNLiveBOrganizationPopCell forIndexPath:indexPath]; | |
| 120 | - | |
| 109 | + CNLiveBOrganizationPopCell *cell = [tableView dequeueReusableCellWithIdentifier:kCNLiveBOrganizationPopCell forIndexPath:indexPath]; | |
| 110 | + | |
| 121 | 111 | return cell; |
| 122 | 112 | } |
| 123 | 113 | |
| ... | ... | @@ -168,15 +158,17 @@ |
| 168 | 158 | |
| 169 | 159 | #pragma mark - 弹出 |
| 170 | 160 | -(void)popViewForView:(UIView *)view{ |
| 171 | - | |
| 172 | - self.frame = CGRectMake(0, KScreenHeight/2, KScreenWidth, KScreenHeight); | |
| 173 | - [self setBackgroundColor:RGBA(0, 0, 0, 0.5)]; | |
| 174 | 161 | [view addSubview:self]; |
| 175 | 162 | [view bringSubviewToFront:self]; |
| 176 | - | |
| 163 | + | |
| 164 | + self.alpha = 0.3; | |
| 165 | + self.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight); | |
| 166 | + self.headerView.frame = CGRectMake(0, KScreenHeight, KScreenWidth, KScreenHeight/2 + kVerticalBottomSafeHeight); | |
| 167 | + [self setBackgroundColor:RGBA(0, 0, 0, 0.5)]; | |
| 177 | 168 | [UIView animateWithDuration:0.25 animations:^{ |
| 169 | + self.alpha = 1.0; | |
| 170 | + self.headerView.frame = CGRectMake(0, KScreenHeight/2 -kVerticalBottomSafeHeight, KScreenWidth, KScreenHeight/2 + kVerticalBottomSafeHeight); | |
| 178 | 171 | |
| 179 | - self.frame = CGRectMake(0,KScreenHeight - CGRectGetHeight(self.frame), KScreenWidth, CGRectGetHeight(self.frame)); | |
| 180 | 172 | |
| 181 | 173 | }]; |
| 182 | 174 | } |
| ... | ... | @@ -184,7 +176,9 @@ |
| 184 | 176 | -(void)dismissView{ |
| 185 | 177 | |
| 186 | 178 | [UIView animateWithDuration:0.25 animations:^{ |
| 187 | - self.frame = CGRectMake(0, KScreenHeight, KScreenWidth,CGRectGetHeight(self.frame)); | |
| 179 | + self.alpha = 0.3; | |
| 180 | + self.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight); | |
| 181 | + self.headerView.frame = CGRectMake(0, KScreenHeight, KScreenWidth, KScreenHeight/2 + kVerticalBottomSafeHeight); | |
| 188 | 182 | } completion:^(BOOL finished) { |
| 189 | 183 | self.dataSourceArr = [NSMutableArray array]; |
| 190 | 184 | [self removeFromSuperview]; |
| ... | ... | @@ -197,7 +191,7 @@ |
| 197 | 191 | #pragma mark - 接口 |
| 198 | 192 | - (void)getAllList{ |
| 199 | 193 | |
| 200 | - | |
| 194 | + | |
| 201 | 195 | |
| 202 | 196 | } |
| 203 | 197 | |
| ... | ... | @@ -233,7 +227,7 @@ |
| 233 | 227 | |
| 234 | 228 | /** 提示视图 */ |
| 235 | 229 | - (UIButton *)returnBtn { |
| 236 | - | |
| 230 | + | |
| 237 | 231 | if (!_returnBtn) { |
| 238 | 232 | _returnBtn = [UIButton buttonWithType:UIButtonTypeCustom]; |
| 239 | 233 | [_returnBtn setImage:[UIImage imageNamedFromOrganization:@"organization_return"] forState:UIControlStateNormal]; | ... | ... |
CNLiveOrganizationValidationModule/Classes/CNLiveOrganizationValidationModule/View/CNLiveBOrganizationContentCell.m
| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | #import <CNLiveBaseKit/CNLiveBaseKit.h> |
| 12 | 12 | #import "CNLiveBOrganizationTextField.h" |
| 13 | 13 | #import "CNLiveBOrganizationButton.h" |
| 14 | +#import "CNLiveBOrganizationImageView.h" | |
| 14 | 15 | |
| 15 | 16 | #pragma mark - |
| 16 | 17 | #pragma mark - UITextField 类型 |
| ... | ... | @@ -586,7 +587,7 @@ |
| 586 | 587 | /** 必须标记*/ |
| 587 | 588 | @property (nonatomic, strong) UIImageView *tipImageV; |
| 588 | 589 | /** 图片*/ |
| 589 | -@property (nonatomic, strong) UIImageView *contentImageView; | |
| 590 | +@property (nonatomic, strong) CNLiveBOrganizationImageView *contentImageView; | |
| 590 | 591 | /** 头部*/ |
| 591 | 592 | @property (nonatomic, strong) UILabel *titleL; |
| 592 | 593 | /** 内容*/ |
| ... | ... | @@ -667,6 +668,7 @@ |
| 667 | 668 | self.tipImageV.centerY = self.contentImageView.centerY; |
| 668 | 669 | self.contentL.frame = CGRectMake(104.5, self.contentImageView.bottom + 6, KScreenWidth - 104.5 - 30.5, 30); |
| 669 | 670 | self.contentImageView.image = [UIImage imageNamedFromOrganization:@"organization_selectedImageS"]; |
| 671 | + self.contentImageView.tipLabel.frame = CGRectMake(0, 60 - 19, 60, 19); | |
| 670 | 672 | #pragma mark - TODO:判断是否有图 |
| 671 | 673 | |
| 672 | 674 | }else if (indexPath.row == 12){ |
| ... | ... | @@ -681,6 +683,7 @@ |
| 681 | 683 | self.tipImageV.centerY = self.titleL.centerY; |
| 682 | 684 | self.contentL.frame = CGRectMake(104.5, self.contentImageView.bottom + 6, KScreenWidth - 104.5 - 30.5, 30); |
| 683 | 685 | self.contentImageView.image = [UIImage imageNamedFromOrganization:@"organization_selectedImageL"]; |
| 686 | + self.contentImageView.tipLabel.frame = CGRectMake(0, 137 - 19, 100, 19); | |
| 684 | 687 | #pragma mark - TODO:判断是否有图 |
| 685 | 688 | |
| 686 | 689 | }else { |
| ... | ... | @@ -716,10 +719,10 @@ |
| 716 | 719 | } |
| 717 | 720 | |
| 718 | 721 | /*** 内容 ***/ |
| 719 | -- (UIImageView *)contentImageView { | |
| 722 | +- (CNLiveBOrganizationImageView *)contentImageView { | |
| 720 | 723 | |
| 721 | 724 | if (!_contentImageView) { |
| 722 | - _contentImageView = [[UIImageView alloc]init]; | |
| 725 | + _contentImageView = [[CNLiveBOrganizationImageView alloc]init]; | |
| 723 | 726 | |
| 724 | 727 | } |
| 725 | 728 | return _contentImageView; |
| ... | ... | @@ -740,6 +743,14 @@ |
| 740 | 743 | } |
| 741 | 744 | |
| 742 | 745 | |
| 746 | +- (UIImageView *)tipImageV { | |
| 747 | + if (!_tipImageV) { | |
| 748 | + _tipImageV = [[UIImageView alloc]init]; | |
| 749 | + _tipImageV.image = [UIImage imageNamedFromOrganization:@"organization_must"]; | |
| 750 | + } | |
| 751 | + return _tipImageV; | |
| 752 | +} | |
| 753 | + | |
| 743 | 754 | |
| 744 | 755 | |
| 745 | 756 | ... | ... |
CNLiveOrganizationValidationModule/Classes/CNLiveOrganizationValidationModule/View/CNLiveBOrganizationValidationHeaderView.h
| ... | ... | @@ -37,7 +37,10 @@ NS_ASSUME_NONNULL_BEGIN |
| 37 | 37 | |
| 38 | 38 | /** 点击item实现*/ |
| 39 | 39 | @property (nonatomic, copy) void(^clickCommitButtonBlock)(CNLiveBOrganizationTVFooteriew *footerView, UIButton *commitBtn); |
| 40 | - | |
| 40 | +/** 点击是否同意协议实现*/ | |
| 41 | +@property (nonatomic, copy) void(^clickAgreementButtonBlock)(CNLiveBOrganizationTVFooteriew *footerView, UIButton *agreementBtn); | |
| 42 | +/** 点击协议内容*/ | |
| 43 | +@property (nonatomic, copy) void(^clickAgreementLBlock)(CNLiveBOrganizationTVFooteriew *footerView, UILabel *agreementL); | |
| 41 | 44 | /** 协议按钮*/ |
| 42 | 45 | @property (nonatomic, strong) UIButton *agreementBtn; |
| 43 | 46 | /** 协议文字*/ | ... | ... |
CNLiveOrganizationValidationModule/Classes/CNLiveOrganizationValidationModule/View/CNLiveBOrganizationValidationHeaderView.m
| ... | ... | @@ -316,9 +316,13 @@ |
| 316 | 316 | NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:contentStr attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:11],NSForegroundColorAttributeName: [UIColor colorWithRed:153/255.0 green:153/255.0 blue:153/255.0 alpha:1.0]}]; |
| 317 | 317 | NSRange range = [contentStr rangeOfString:@"《中国网+内容安全协议》"]; |
| 318 | 318 | [string addAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:11], NSForegroundColorAttributeName: [UIColor colorWithRed:72/255.0 green:167/255.0 blue:249/255.0 alpha:1.0]} range:range]; |
| 319 | - _agreementL.attributedText = string; | |
| 319 | + self.agreementL.attributedText = string; | |
| 320 | 320 | |
| 321 | 321 | [self.commitBtn addTarget:self action:@selector(commitBtnAction:) forControlEvents:UIControlEventTouchUpInside]; |
| 322 | + [self.agreementBtn addTarget:self action:@selector(agreementBtnAction:) forControlEvents:UIControlEventTouchUpInside]; | |
| 323 | + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(agreementLAction:)]; | |
| 324 | + self.agreementL.userInteractionEnabled = YES; | |
| 325 | + [self.agreementL addGestureRecognizer:tap]; | |
| 322 | 326 | |
| 323 | 327 | } |
| 324 | 328 | |
| ... | ... | @@ -361,6 +365,20 @@ |
| 361 | 365 | |
| 362 | 366 | } |
| 363 | 367 | |
| 368 | +- (void)agreementBtnAction:(UIButton *)btn { | |
| 369 | + if (self.clickAgreementButtonBlock) { | |
| 370 | + self.clickAgreementButtonBlock(self, btn); | |
| 371 | + } | |
| 372 | +} | |
| 373 | + | |
| 374 | +- (void)agreementLAction:(UITapGestureRecognizer *)tap { | |
| 375 | + UILabel *agreementL = (UILabel *)tap.view; | |
| 376 | + if (self.clickAgreementLBlock) { | |
| 377 | + self.clickAgreementLBlock(self, agreementL); | |
| 378 | + } | |
| 379 | +} | |
| 380 | + | |
| 381 | + | |
| 364 | 382 | |
| 365 | 383 | #pragma mark - ***私有方法*** |
| 366 | 384 | #pragma mark - ***懒加载*** |
| ... | ... | @@ -370,7 +388,7 @@ |
| 370 | 388 | |
| 371 | 389 | if (!_agreementBtn) { |
| 372 | 390 | _agreementBtn = [UIButton buttonWithType:UIButtonTypeCustom]; |
| 373 | - [_agreementBtn setImage:[UIImage imageNamedFromOrganization:@"organization_selected"] forState:UIControlStateNormal]; | |
| 391 | + [_agreementBtn setImage:[UIImage imageNamedFromOrganization:@"organization_normal"] forState:UIControlStateNormal]; | |
| 374 | 392 | [_agreementBtn setImage:[UIImage imageNamedFromOrganization:@"organization_selected"] forState:UIControlStateSelected]; |
| 375 | 393 | } |
| 376 | 394 | return _agreementBtn; | ... | ... |
Example/CNLiveOrganizationValidationModule/CNLiveOrganizationValidationModule-Info.plist
| ... | ... | @@ -2,8 +2,34 @@ |
| 2 | 2 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| 3 | 3 | <plist version="1.0"> |
| 4 | 4 | <dict> |
| 5 | + <key>NSContactsUsageDescription</key> | |
| 6 | + <string>请求访问通讯录</string> | |
| 7 | + <key>NSCameraUsageDescription</key> | |
| 8 | + <string>App需要您的同意,才能访问相机</string> | |
| 9 | + <key>NSPhotoLibraryUsageDescription</key> | |
| 10 | + <string>App需要您的同意,才能访问相册</string> | |
| 11 | + <key>NSAppleMusicUsageDescription</key> | |
| 12 | + <string>App需要您的同意,才能访问媒体资料库</string> | |
| 13 | + <key>NSBluetoothPeripheralUsageDescription</key> | |
| 14 | + <string>App需要您的同意,才能访问蓝牙</string> | |
| 15 | + <key>NSCalendarsUsageDescription</key> | |
| 16 | + <string>App需要您的同意,才能访问日历</string> | |
| 17 | + <key>NSHealthShareUsageDescription</key> | |
| 18 | + <string>App需要您的同意,才能访问健康分享</string> | |
| 19 | + <key>NSHealthUpdateUsageDescription</key> | |
| 20 | + <string>App需要您的同意,才能访问健康更新 </string> | |
| 21 | + <key>NSLocationAlwaysUsageDescription</key> | |
| 22 | + <string>App需要您的同意,才能始终访问位置</string> | |
| 23 | + <key>NSLocationUsageDescription</key> | |
| 24 | + <string>App需要您的同意,才能访问位置</string> | |
| 25 | + <key>NSMicrophoneUsageDescription</key> | |
| 26 | + <string>App需要您的同意,才能访问麦克风</string> | |
| 27 | + <key>NSMotionUsageDescription</key> | |
| 28 | + <string>App需要您的同意,才能访问运动与健身</string> | |
| 29 | + <key>NSRemindersUsageDescription</key> | |
| 30 | + <string>App需要您的同意,才能访问提醒事项</string> | |
| 5 | 31 | <key>CFBundleDevelopmentRegion</key> |
| 6 | - <string>en</string> | |
| 32 | + <string>zh_CN</string> | |
| 7 | 33 | <key>CFBundleDisplayName</key> |
| 8 | 34 | <string>${PRODUCT_NAME}</string> |
| 9 | 35 | <key>CFBundleExecutable</key> | ... | ... |