Commit 8d95717d authored by tanzhen's avatar tanzhen

自定义TZCollectionView,优化照片列表页的滑动

parent e993595c
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
......
......@@ -106,11 +106,11 @@
- (UIButton *)selectPhotoButton {
if (_selectImageView == nil) {
UIButton *selectImageView = [[UIButton alloc] init];
selectImageView.frame = CGRectMake(self.tz_width - 44, 0, 44, 44);
[selectImageView addTarget:self action:@selector(selectPhotoButtonClick:) forControlEvents:UIControlEventTouchUpInside];
[self.contentView addSubview:selectImageView];
_selectPhotoButton = selectImageView;
UIButton *selectPhotoButton = [[UIButton alloc] init];
selectPhotoButton.frame = CGRectMake(self.tz_width - 44, 0, 44, 44);
[selectPhotoButton addTarget:self action:@selector(selectPhotoButtonClick:) forControlEvents:UIControlEventTouchUpInside];
[self.contentView addSubview:selectPhotoButton];
_selectPhotoButton = selectPhotoButton;
}
return _selectPhotoButton;
}
......
......@@ -18,3 +18,8 @@
@property (nonatomic, copy) void (^backButtonClickHandle)(TZAlbumModel *model);
@end
@interface TZCollectionView : UICollectionView
@end
......@@ -30,7 +30,7 @@
}
@property CGRect previousPreheatRect;
@property (nonatomic, assign) BOOL isSelectOriginalPhoto;
@property (nonatomic, strong) UICollectionView *collectionView;
@property (nonatomic, strong) TZCollectionView *collectionView;
@property (nonatomic, strong) UIImagePickerController *imagePickerVc;
@end
......@@ -122,7 +122,7 @@ static CGSize AssetGridThumbnailSize;
CGFloat top = 44;
if (iOS7Later) top += 20;
CGFloat collectionViewHeight = tzImagePickerVc.maxImagesCount > 1 ? self.view.tz_height - 50 - top : self.view.tz_height - top;
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, top, self.view.tz_width, collectionViewHeight) collectionViewLayout:layout];
_collectionView = [[TZCollectionView alloc] initWithFrame:CGRectMake(0, top, self.view.tz_width, collectionViewHeight) collectionViewLayout:layout];
_collectionView.backgroundColor = [UIColor whiteColor];
_collectionView.dataSource = self;
_collectionView.delegate = self;
......@@ -719,3 +719,16 @@ static CGSize AssetGridThumbnailSize;
}
@end
@implementation TZCollectionView
- (BOOL)touchesShouldCancelInContentView:(UIView *)view {
if ( [view isKindOfClass:[UIControl class]]) {
return YES;
}
return [super touchesShouldCancelInContentView:view];
}
@end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment