Commit 1b577725 authored by banchichen's avatar banchichen

新增allowTakePicture属性,可隐藏拍照按钮

parent 56769d31
......@@ -56,6 +56,10 @@
/// 默认为YES,如果设置为NO,用户将不能选择发送图片
@property(nonatomic, assign) BOOL allowPickingImage;
/// Default is YES.if set NO, user can't take picture.
/// 默认为YES,如果设置为NO,拍照按钮将隐藏,用户将不能在选择器中拍照
@property(nonatomic, assign) BOOL allowTakePicture;
/// The photos user have selected
/// 用户选中过的图片数组
@property (nonatomic, strong) NSMutableArray *selectedAssets;
......
......@@ -85,6 +85,7 @@
self.allowPickingOriginalPhoto = YES;
self.allowPickingVideo = YES;
self.allowPickingImage = YES;
self.allowTakePicture = YES;
self.timeout = 15;
self.photoWidth = 828.0;
self.photoPreviewMaxWidth = 540;
......
......@@ -109,7 +109,9 @@ static CGSize AssetGridThumbnailSize;
_collectionView.alwaysBounceHorizontal = NO;
if (iOS7Later) _collectionView.contentInset = UIEdgeInsetsMake(0, 0, 0, 2);
_collectionView.scrollIndicatorInsets = UIEdgeInsetsMake(0, 0, 0, -2);
if ([_model.name isEqualToString:@"相机胶卷"] || [_model.name isEqualToString:@"Camera Roll"] || [_model.name isEqualToString:@"所有照片"] ) {
TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
if (([_model.name isEqualToString:@"相机胶卷"] || [_model.name isEqualToString:@"Camera Roll"] || [_model.name isEqualToString:@"所有照片"]) && tzImagePickerVc.allowTakePicture ) {
_collectionView.contentSize = CGSizeMake(self.view.tz_width, ((_model.count + 4) / 4) * self.view.tz_width);
} else {
_collectionView.contentSize = CGSizeMake(self.view.tz_width, ((_model.count + 3) / 4) * self.view.tz_width);
......@@ -287,7 +289,7 @@ static CGSize AssetGridThumbnailSize;
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
if ([_model.name isEqualToString:@"相机胶卷"] || [_model.name isEqualToString:@"Camera Roll"] || [_model.name isEqualToString:@"所有照片"] ) {
TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
if (tzImagePickerVc.allowPickingImage) {
if (tzImagePickerVc.allowPickingImage && tzImagePickerVc.allowTakePicture) {
return _models.count + 1;
}
}
......@@ -442,7 +444,7 @@ static CGSize AssetGridThumbnailSize;
NSInteger item = _models.count - 1;
if ([_model.name isEqualToString:@"相机胶卷"] || [_model.name isEqualToString:@"Camera Roll"] || [_model.name isEqualToString:@"所有照片"] ) {
TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
if (tzImagePickerVc.allowPickingImage) {
if (tzImagePickerVc.allowPickingImage && tzImagePickerVc.allowTakePicture) {
item += 1;
}
}
......
......@@ -123,7 +123,8 @@
TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:9 delegate:self];
imagePickerVc.isSelectOriginalPhoto = _isSelectOriginalPhoto;
imagePickerVc.selectedAssets = _selectedAssets; // optional, 可选的
// imagePickerVc.allowTakePicture = NO; // 隐藏拍照按钮
// You can get the photos by block, the same as by delegate.
// 你可以通过block或者代理,来得到用户选择的照片.
[imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {
......
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