Commit 04531cdaa17e12614d283ce8997ce266039a5c00
1 parent
9b98c3f1
no message
Showing
4 changed files
with
28 additions
and
30 deletions
CNLiveSettingModule/Classes/Privacy/CNLiveNotSeeCollectionViewCell.h renamed to CNLiveSettingModule/Classes/Privacy/CNLiveNotSeeCell.h
| 1 | // | 1 | // |
| 2 | -// CNLiveNotSeeCollectionViewCell.h | 2 | +// CNLiveNotSeeCell.h |
| 3 | // CNLiveSettingModule | 3 | // CNLiveSettingModule |
| 4 | // | 4 | // |
| 5 | // Created by CNLive-zxw on 2019/4/22. | 5 | // Created by CNLive-zxw on 2019/4/22. |
| @@ -9,18 +9,18 @@ | @@ -9,18 +9,18 @@ | ||
| 9 | #import <UIKit/UIKit.h> | 9 | #import <UIKit/UIKit.h> |
| 10 | 10 | ||
| 11 | NS_ASSUME_NONNULL_BEGIN | 11 | NS_ASSUME_NONNULL_BEGIN |
| 12 | -#define kCNLiveNotSeeCollectionViewCell @"CNLiveNotSeeCollectionViewCell" | 12 | +#define kCNLiveNotSeeCell @"CNLiveNotSeeCell" |
| 13 | @class CNLiveNotSeeModel; | 13 | @class CNLiveNotSeeModel; |
| 14 | -@class CNLiveNotSeeCollectionViewCell; | 14 | +@class CNLiveNotSeeCell; |
| 15 | 15 | ||
| 16 | -@protocol CNLiveNotSeeCollectionViewCellDelegate <NSObject> | ||
| 17 | -- (void)clickedDelButton:(CNLiveNotSeeCollectionViewCell *)cell; | ||
| 18 | -- (void)longPressCell:(CNLiveNotSeeCollectionViewCell *)cell; | 16 | +@protocol CNLiveNotSeeCellDelegate <NSObject> |
| 17 | +- (void)clickedDel:(CNLiveNotSeeCell *)cell; | ||
| 18 | +- (void)longPressCell:(CNLiveNotSeeCell *)cell; | ||
| 19 | 19 | ||
| 20 | @end | 20 | @end |
| 21 | -@interface CNLiveNotSeeCollectionViewCell : UICollectionViewCell | 21 | +@interface CNLiveNotSeeCell : UICollectionViewCell |
| 22 | @property (nonatomic, strong) CNLiveNotSeeModel *model; | 22 | @property (nonatomic, strong) CNLiveNotSeeModel *model; |
| 23 | -@property (nonatomic, weak) id<CNLiveNotSeeCollectionViewCellDelegate> delegate; | 23 | +@property (nonatomic, weak) id<CNLiveNotSeeCellDelegate> delegate; |
| 24 | 24 | ||
| 25 | @end | 25 | @end |
| 26 | 26 |
CNLiveSettingModule/Classes/Privacy/CNLiveNotSeeCollectionViewCell.m renamed to CNLiveSettingModule/Classes/Privacy/CNLiveNotSeeCell.m
| 1 | // | 1 | // |
| 2 | -// CNLiveNotSeeCollectionViewCell.m | 2 | +// CNLiveNotSeeCell.m |
| 3 | // CNLiveSettingModule | 3 | // CNLiveSettingModule |
| 4 | // | 4 | // |
| 5 | // Created by CNLive-zxw on 2019/4/22. | 5 | // Created by CNLive-zxw on 2019/4/22. |
| 6 | // Copyright © 2019 cnlive. All rights reserved. | 6 | // Copyright © 2019 cnlive. All rights reserved. |
| 7 | // | 7 | // |
| 8 | 8 | ||
| 9 | -#import "CNLiveNotSeeCollectionViewCell.h" | 9 | +#import "CNLiveNotSeeCell.h" |
| 10 | #import <SDWebImage/SDWebImage.h> | 10 | #import <SDWebImage/SDWebImage.h> |
| 11 | #import "QMUIKit.h" | 11 | #import "QMUIKit.h" |
| 12 | #import <Masonry/Masonry.h> | 12 | #import <Masonry/Masonry.h> |
| @@ -14,14 +14,14 @@ | @@ -14,14 +14,14 @@ | ||
| 14 | 14 | ||
| 15 | #import "CNLiveNotSeeModel.h" | 15 | #import "CNLiveNotSeeModel.h" |
| 16 | 16 | ||
| 17 | -@interface CNLiveNotSeeCollectionViewCell() | 17 | +@interface CNLiveNotSeeCell() |
| 18 | @property (nonatomic, strong) UIButton *delButton; | 18 | @property (nonatomic, strong) UIButton *delButton; |
| 19 | @property (nonatomic, strong) UIImageView *avatarImage; | 19 | @property (nonatomic, strong) UIImageView *avatarImage; |
| 20 | @property (nonatomic, strong) UILabel *nameLabel; | 20 | @property (nonatomic, strong) UILabel *nameLabel; |
| 21 | 21 | ||
| 22 | @end | 22 | @end |
| 23 | 23 | ||
| 24 | -@implementation CNLiveNotSeeCollectionViewCell | 24 | +@implementation CNLiveNotSeeCell |
| 25 | - (instancetype)initWithFrame:(CGRect)frame { | 25 | - (instancetype)initWithFrame:(CGRect)frame { |
| 26 | self = [super initWithFrame:frame]; | 26 | self = [super initWithFrame:frame]; |
| 27 | if (self) { | 27 | if (self) { |
| @@ -38,14 +38,14 @@ | @@ -38,14 +38,14 @@ | ||
| 38 | if(model.type == CNLiveNotSeeModelTypeAdd){ | 38 | if(model.type == CNLiveNotSeeModelTypeAdd){ |
| 39 | _avatarImage.layer.masksToBounds = NO; | 39 | _avatarImage.layer.masksToBounds = NO; |
| 40 | _avatarImage.layer.cornerRadius = 0; | 40 | _avatarImage.layer.cornerRadius = 0; |
| 41 | - UIImage *xw_image = [self getImageWithImageName:@"privacy_plus" bundleName:@"CNLiveSettingModule" targetClass:[CNLiveNotSeeCollectionViewCell class]]; | 41 | + UIImage *xw_image = [self getImageWithImageName:@"privacy_plus" bundleName:@"CNLiveSettingModule" targetClass:[self class]]; |
| 42 | [_avatarImage sd_setImageWithURL:[NSURL URLWithString:@""] placeholderImage:xw_image]; | 42 | [_avatarImage sd_setImageWithURL:[NSURL URLWithString:@""] placeholderImage:xw_image]; |
| 43 | _nameLabel.text = @""; | 43 | _nameLabel.text = @""; |
| 44 | 44 | ||
| 45 | }else if (model.type == CNLiveNotSeeModelTypeMinus){ | 45 | }else if (model.type == CNLiveNotSeeModelTypeMinus){ |
| 46 | _avatarImage.layer.masksToBounds = NO; | 46 | _avatarImage.layer.masksToBounds = NO; |
| 47 | _avatarImage.layer.cornerRadius = 0; | 47 | _avatarImage.layer.cornerRadius = 0; |
| 48 | - UIImage *xw_image = [self getImageWithImageName:@"privacy_less" bundleName:@"CNLiveSettingModule" targetClass:[CNLiveNotSeeCollectionViewCell class]]; | 48 | + UIImage *xw_image = [self getImageWithImageName:@"privacy_less" bundleName:@"CNLiveSettingModule" targetClass:[self class]]; |
| 49 | [_avatarImage sd_setImageWithURL:[NSURL URLWithString:@""] placeholderImage:xw_image]; | 49 | [_avatarImage sd_setImageWithURL:[NSURL URLWithString:@""] placeholderImage:xw_image]; |
| 50 | _nameLabel.text = @""; | 50 | _nameLabel.text = @""; |
| 51 | 51 | ||
| @@ -128,8 +128,8 @@ | @@ -128,8 +128,8 @@ | ||
| 128 | 128 | ||
| 129 | #pragma mark - Action Methods | 129 | #pragma mark - Action Methods |
| 130 | - (void)delButtonDidClicked:(UIButton *)btn{ | 130 | - (void)delButtonDidClicked:(UIButton *)btn{ |
| 131 | - if (self.delegate && [self.delegate respondsToSelector:@selector(clickedDelButton:)]) { | ||
| 132 | - [self.delegate clickedDelButton:self]; | 131 | + if (self.delegate && [self.delegate respondsToSelector:@selector(clickedDel:)]) { |
| 132 | + [self.delegate clickedDel:self]; | ||
| 133 | } | 133 | } |
| 134 | } | 134 | } |
| 135 | 135 | ||
| @@ -138,9 +138,7 @@ | @@ -138,9 +138,7 @@ | ||
| 138 | if(_model.type == CNLiveNotSeeModelTypeAdd||_model.type == CNLiveNotSeeModelTypeMinus){ | 138 | if(_model.type == CNLiveNotSeeModelTypeAdd||_model.type == CNLiveNotSeeModelTypeMinus){ |
| 139 | return; | 139 | return; |
| 140 | } | 140 | } |
| 141 | - //进行判断,在什么时候触发事件 | ||
| 142 | if (sender.state == UIGestureRecognizerStateBegan) { | 141 | if (sender.state == UIGestureRecognizerStateBegan) { |
| 143 | - NSLog(@"长按状态"); | ||
| 144 | if (self.delegate && [self.delegate respondsToSelector:@selector(longPressCell:)]) { | 142 | if (self.delegate && [self.delegate respondsToSelector:@selector(longPressCell:)]) { |
| 145 | [self.delegate longPressCell:self]; | 143 | [self.delegate longPressCell:self]; |
| 146 | } | 144 | } |
CNLiveSettingModule/Classes/Privacy/CNLiveNotSeeController.m
| @@ -18,11 +18,11 @@ | @@ -18,11 +18,11 @@ | ||
| 18 | #import "CNLiveBaseKit.h" | 18 | #import "CNLiveBaseKit.h" |
| 19 | 19 | ||
| 20 | #import "CNLiveNavigationBar.h" | 20 | #import "CNLiveNavigationBar.h" |
| 21 | -#import "CNLiveNotSeeCollectionViewCell.h" | 21 | +#import "CNLiveNotSeeCell.h" |
| 22 | #import "CNLiveNotSeeModel.h" | 22 | #import "CNLiveNotSeeModel.h" |
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | -@interface CNLiveNotSeeController ()<UICollectionViewDelegate, UICollectionViewDataSource, CNLiveNotSeeCollectionViewCellDelegate>{ | 25 | +@interface CNLiveNotSeeController ()<UICollectionViewDelegate, UICollectionViewDataSource, CNLiveNotSeeCellDelegate>{ |
| 26 | BOOL _isEdit; | 26 | BOOL _isEdit; |
| 27 | } | 27 | } |
| 28 | 28 | ||
| @@ -122,17 +122,13 @@ static const NSInteger SectionHeight = 50; | @@ -122,17 +122,13 @@ static const NSInteger SectionHeight = 50; | ||
| 122 | 122 | ||
| 123 | }]; | 123 | }]; |
| 124 | } | 124 | } |
| 125 | -#pragma mark - CollectionView Delegate | ||
| 126 | -- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{ | ||
| 127 | - return 1; | ||
| 128 | - | ||
| 129 | -} | 125 | +#pragma mark - UICollectionViewDelegate |
| 130 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ | 126 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ |
| 131 | return self.afterData.count; | 127 | return self.afterData.count; |
| 132 | 128 | ||
| 133 | } | 129 | } |
| 134 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ | 130 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ |
| 135 | - CNLiveNotSeeCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kCNLiveNotSeeCollectionViewCell forIndexPath:indexPath]; | 131 | + CNLiveNotSeeCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kCNLiveNotSeeCell forIndexPath:indexPath]; |
| 136 | cell.model = self.afterData[indexPath.row]; | 132 | cell.model = self.afterData[indexPath.row]; |
| 137 | cell.delegate = self; | 133 | cell.delegate = self; |
| 138 | return cell; | 134 | return cell; |
| @@ -205,13 +201,13 @@ static const NSInteger SectionHeight = 50; | @@ -205,13 +201,13 @@ static const NSInteger SectionHeight = 50; | ||
| 205 | } | 201 | } |
| 206 | 202 | ||
| 207 | } | 203 | } |
| 208 | -#pragma mark - CNLiveNotSeeCollectionViewCellDelegate | ||
| 209 | -- (void)longPressCell:(CNLiveNotSeeCollectionViewCell *)cell{ | 204 | +#pragma mark - CNLiveNotSeeCellDelegate |
| 205 | +- (void)longPressCell:(CNLiveNotSeeCell *)cell{ | ||
| 210 | [self changeEditState]; | 206 | [self changeEditState]; |
| 211 | 207 | ||
| 212 | } | 208 | } |
| 213 | 209 | ||
| 214 | -- (void)clickedDelButton:(CNLiveNotSeeCollectionViewCell *)cell{ | 210 | +- (void)clickedDel:(CNLiveNotSeeCell *)cell{ |
| 215 | if([self.afterData containsObject:cell.model]){ | 211 | if([self.afterData containsObject:cell.model]){ |
| 216 | [self.afterData removeObject:cell.model]; | 212 | [self.afterData removeObject:cell.model]; |
| 217 | 213 | ||
| @@ -500,7 +496,7 @@ static const NSInteger SectionHeight = 50; | @@ -500,7 +496,7 @@ static const NSInteger SectionHeight = 50; | ||
| 500 | 496 | ||
| 501 | _collectionView.showsVerticalScrollIndicator = NO; | 497 | _collectionView.showsVerticalScrollIndicator = NO; |
| 502 | _collectionView.showsHorizontalScrollIndicator = NO; | 498 | _collectionView.showsHorizontalScrollIndicator = NO; |
| 503 | - [_collectionView registerClass:[CNLiveNotSeeCollectionViewCell class] forCellWithReuseIdentifier:kCNLiveNotSeeCollectionViewCell]; | 499 | + [_collectionView registerClass:[CNLiveNotSeeCell class] forCellWithReuseIdentifier:kCNLiveNotSeeCell]; |
| 504 | [_collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"UICollectionElementKindSectionHeader"]; | 500 | [_collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"UICollectionElementKindSectionHeader"]; |
| 505 | flowLayout.headerReferenceSize = CGSizeMake(SCREEN_WIDTH, 0.0000001); | 501 | flowLayout.headerReferenceSize = CGSizeMake(SCREEN_WIDTH, 0.0000001); |
| 506 | 502 |
Example/CNLiveSettingModule.xcodeproj/project.pbxproj
| @@ -352,6 +352,7 @@ | @@ -352,6 +352,7 @@ | ||
| 352 | "${PODS_ROOT}/Target Support Files/Pods-CNLiveSettingModule_Example/Pods-CNLiveSettingModule_Example-frameworks.sh", | 352 | "${PODS_ROOT}/Target Support Files/Pods-CNLiveSettingModule_Example/Pods-CNLiveSettingModule_Example-frameworks.sh", |
| 353 | "${BUILT_PRODUCTS_DIR}/AFNetworking/AFNetworking.framework", | 353 | "${BUILT_PRODUCTS_DIR}/AFNetworking/AFNetworking.framework", |
| 354 | "${BUILT_PRODUCTS_DIR}/CNLiveAVCamera/CNLiveAVCamera.framework", | 354 | "${BUILT_PRODUCTS_DIR}/CNLiveAVCamera/CNLiveAVCamera.framework", |
| 355 | + "${BUILT_PRODUCTS_DIR}/CNLiveBaseClass/CNLiveBaseClass.framework", | ||
| 355 | "${BUILT_PRODUCTS_DIR}/CNLiveBaseKit/CNLiveBaseKit.framework", | 356 | "${BUILT_PRODUCTS_DIR}/CNLiveBaseKit/CNLiveBaseKit.framework", |
| 356 | "${BUILT_PRODUCTS_DIR}/CNLiveBaseTools/CNLiveBaseTools.framework", | 357 | "${BUILT_PRODUCTS_DIR}/CNLiveBaseTools/CNLiveBaseTools.framework", |
| 357 | "${BUILT_PRODUCTS_DIR}/CNLiveBeeHive/CNLiveBeeHive.framework", | 358 | "${BUILT_PRODUCTS_DIR}/CNLiveBeeHive/CNLiveBeeHive.framework", |
| @@ -376,12 +377,14 @@ | @@ -376,12 +377,14 @@ | ||
| 376 | "${BUILT_PRODUCTS_DIR}/Qiniu/Qiniu.framework", | 377 | "${BUILT_PRODUCTS_DIR}/Qiniu/Qiniu.framework", |
| 377 | "${BUILT_PRODUCTS_DIR}/SDAutoLayout/SDAutoLayout.framework", | 378 | "${BUILT_PRODUCTS_DIR}/SDAutoLayout/SDAutoLayout.framework", |
| 378 | "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", | 379 | "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", |
| 380 | + "${BUILT_PRODUCTS_DIR}/WebViewJavascriptBridge/WebViewJavascriptBridge.framework", | ||
| 379 | "${BUILT_PRODUCTS_DIR}/YYKit/YYKit.framework", | 381 | "${BUILT_PRODUCTS_DIR}/YYKit/YYKit.framework", |
| 380 | ); | 382 | ); |
| 381 | name = "[CP] Embed Pods Frameworks"; | 383 | name = "[CP] Embed Pods Frameworks"; |
| 382 | outputPaths = ( | 384 | outputPaths = ( |
| 383 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AFNetworking.framework", | 385 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AFNetworking.framework", |
| 384 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveAVCamera.framework", | 386 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveAVCamera.framework", |
| 387 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseClass.framework", | ||
| 385 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseKit.framework", | 388 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseKit.framework", |
| 386 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseTools.framework", | 389 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseTools.framework", |
| 387 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBeeHive.framework", | 390 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBeeHive.framework", |
| @@ -406,6 +409,7 @@ | @@ -406,6 +409,7 @@ | ||
| 406 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Qiniu.framework", | 409 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Qiniu.framework", |
| 407 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDAutoLayout.framework", | 410 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDAutoLayout.framework", |
| 408 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", | 411 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", |
| 412 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/WebViewJavascriptBridge.framework", | ||
| 409 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYKit.framework", | 413 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYKit.framework", |
| 410 | ); | 414 | ); |
| 411 | runOnlyForDeploymentPostprocessing = 0; | 415 | runOnlyForDeploymentPostprocessing = 0; |