Commit b788a593 authored by banchichen's avatar banchichen

可以设置不进入预览页面

parent 90a5682e
...@@ -192,7 +192,7 @@ ...@@ -192,7 +192,7 @@
<rect key="frame" x="0.0" y="300" width="320" height="35"/> <rect key="frame" x="0.0" y="300" width="320" height="35"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews> <subviews>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="0ju-HJ-A06"> <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="0ju-HJ-A06">
<rect key="frame" x="225" y="2" width="51" height="31"/> <rect key="frame" x="225" y="2" width="51" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<connections> <connections>
...@@ -213,7 +213,7 @@ ...@@ -213,7 +213,7 @@
<rect key="frame" x="0.0" y="335" width="320" height="35"/> <rect key="frame" x="0.0" y="335" width="320" height="35"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews> <subviews>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hsH-wt-l1R"> <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="hsH-wt-l1R">
<rect key="frame" x="225" y="2" width="51" height="31"/> <rect key="frame" x="225" y="2" width="51" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<connections> <connections>
......
...@@ -77,6 +77,10 @@ ...@@ -77,6 +77,10 @@
/// 默认为YES,如果设置为NO,拍照按钮将隐藏,用户将不能在选择器中拍照 /// 默认为YES,如果设置为NO,拍照按钮将隐藏,用户将不能在选择器中拍照
@property(nonatomic, assign) BOOL allowTakePicture; @property(nonatomic, assign) BOOL allowTakePicture;
/// Default is YES.if set NO, user can't preview photo.
/// 默认为YES,如果设置为NO,预览按钮将隐藏,用户将不能去预览照片
@property (nonatomic, assign) BOOL allowPreview;
/// Default is YES.if set NO, the picker don't dismiss itself. /// Default is YES.if set NO, the picker don't dismiss itself.
/// 默认为YES,如果设置为NO, 选择器将不会自己dismiss /// 默认为YES,如果设置为NO, 选择器将不会自己dismiss
@property(nonatomic, assign) BOOL autoDismiss; @property(nonatomic, assign) BOOL autoDismiss;
......
...@@ -202,6 +202,7 @@ ...@@ -202,6 +202,7 @@
self.photoPreviewMaxWidth = 600; self.photoPreviewMaxWidth = 600;
self.barItemTextFont = [UIFont systemFontOfSize:15]; self.barItemTextFont = [UIFont systemFontOfSize:15];
self.barItemTextColor = [UIColor whiteColor]; self.barItemTextColor = [UIColor whiteColor];
self.allowPreview = YES;
[self configDefaultImageName]; [self configDefaultImageName];
[self configDefaultBtnTitle]; [self configDefaultBtnTitle];
......
...@@ -165,10 +165,13 @@ static CGSize AssetGridThumbnailSize; ...@@ -165,10 +165,13 @@ static CGSize AssetGridThumbnailSize;
CGFloat rgb = 253 / 255.0; CGFloat rgb = 253 / 255.0;
bottomToolBar.backgroundColor = [UIColor colorWithRed:rgb green:rgb blue:rgb alpha:1.0]; bottomToolBar.backgroundColor = [UIColor colorWithRed:rgb green:rgb blue:rgb alpha:1.0];
CGFloat previewWidth = [tzImagePickerVc.previewBtnTitleStr boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16]} context:nil].size.width; CGFloat previewWidth = [tzImagePickerVc.previewBtnTitleStr boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16]} context:nil].size.width + 2;
if (!tzImagePickerVc.allowPreview) {
previewWidth = 0.0;
}
_previewButton = [UIButton buttonWithType:UIButtonTypeCustom]; _previewButton = [UIButton buttonWithType:UIButtonTypeCustom];
_previewButton.frame = CGRectMake(10, 3, previewWidth + 2, 44); _previewButton.frame = CGRectMake(10, 3, previewWidth, 44);
_previewButton.tz_width = !tzImagePickerVc.showSelectBtn ? 0 : previewWidth + 2; _previewButton.tz_width = !tzImagePickerVc.showSelectBtn ? 0 : previewWidth;
[_previewButton addTarget:self action:@selector(previewButtonClick) forControlEvents:UIControlEventTouchUpInside]; [_previewButton addTarget:self action:@selector(previewButtonClick) forControlEvents:UIControlEventTouchUpInside];
_previewButton.titleLabel.font = [UIFont systemFontOfSize:16]; _previewButton.titleLabel.font = [UIFont systemFontOfSize:16];
[_previewButton setTitle:tzImagePickerVc.previewBtnTitleStr forState:UIControlStateNormal]; [_previewButton setTitle:tzImagePickerVc.previewBtnTitleStr forState:UIControlStateNormal];
...@@ -363,6 +366,9 @@ static CGSize AssetGridThumbnailSize; ...@@ -363,6 +366,9 @@ static CGSize AssetGridThumbnailSize;
} }
cell.model = model; cell.model = model;
cell.showSelectBtn = tzImagePickerVc.showSelectBtn; cell.showSelectBtn = tzImagePickerVc.showSelectBtn;
if (!tzImagePickerVc.allowPreview) {
cell.selectPhotoButton.frame = cell.bounds;
}
__weak typeof(cell) weakCell = cell; __weak typeof(cell) weakCell = cell;
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
......
...@@ -233,6 +233,8 @@ ...@@ -233,6 +233,8 @@
cropView.layer.borderColor = [UIColor redColor].CGColor; cropView.layer.borderColor = [UIColor redColor].CGColor;
cropView.layer.borderWidth = 2.0; cropView.layer.borderWidth = 2.0;
}];*/ }];*/
//imagePickerVc.allowPreview = NO;
#pragma mark - 到这里为止 #pragma mark - 到这里为止
// You can get the photos by block, the same as by delegate. // You can get the photos by block, the same as by delegate.
...@@ -434,6 +436,8 @@ ...@@ -434,6 +436,8 @@
- (IBAction)allowPickingOriginPhotoSwitchClick:(UISwitch *)sender { - (IBAction)allowPickingOriginPhotoSwitchClick:(UISwitch *)sender {
if (sender.isOn) { if (sender.isOn) {
[_allowPickingImageSwitch setOn:YES animated:YES]; [_allowPickingImageSwitch setOn:YES animated:YES];
[self.needCircleCropSwitch setOn:NO animated:YES];
[self.allowCropSwitch setOn:NO animated:YES];
} }
} }
...@@ -454,6 +458,7 @@ ...@@ -454,6 +458,7 @@
- (IBAction)allowCropSwitchClick:(UISwitch *)sender { - (IBAction)allowCropSwitchClick:(UISwitch *)sender {
if (sender.isOn) { if (sender.isOn) {
self.maxCountTF.text = @"1"; self.maxCountTF.text = @"1";
[self.allowPickingOriginalPhotoSwitch setOn:NO animated:YES];
} else { } else {
[self.needCircleCropSwitch setOn:NO animated:YES]; [self.needCircleCropSwitch setOn:NO animated:YES];
} }
...@@ -463,6 +468,7 @@ ...@@ -463,6 +468,7 @@
if (sender.isOn) { if (sender.isOn) {
[self.allowCropSwitch setOn:YES animated:YES]; [self.allowCropSwitch setOn:YES animated:YES];
self.maxCountTF.text = @"1"; self.maxCountTF.text = @"1";
[self.allowPickingOriginalPhotoSwitch setOn:NO animated:YES];
} }
} }
......
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