Skip to content

Commit 2348607

Browse files
committed
2.7.3
1 parent 7e0f488 commit 2348607

23 files changed

+435
-196
lines changed

QMUIKit.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "QMUIKit"
3-
s.version = "2.7.2"
3+
s.version = "2.7.3"
44
s.summary = "致力于提高项目 UI 开发效率的解决方案"
55
s.description = <<-DESC
66
QMUI iOS 是一个致力于提高项目 UI 开发效率的解决方案,其设计目的是用于辅助快速搭建一个具备基本设计还原效果的 iOS 项目,同时利用自身提供的丰富控件及兼容处理, 让开发者能专注于业务需求而无需耗费精力在基础代码的设计上。不管是新项目的创建,或是已有项目的维护,均可使开发效率和项目质量得到大幅度提升。

QMUIKit/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>2.7.2</string>
18+
<string>2.7.3</string>
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
<key>NSPrincipalClass</key>

QMUIKit/QMUIComponents/AssetLibrary/QMUIAsset.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ - (NSInteger)requestPreviewImageWithCompletion:(void (^)(UIImage *result, NSDict
139139
PHImageRequestOptions *imageRequestOptions = [[PHImageRequestOptions alloc] init];
140140
imageRequestOptions.networkAccessAllowed = YES; // 允许访问网络
141141
imageRequestOptions.progressHandler = phProgressHandler;
142-
return [[[QMUIAssetsManager sharedInstance] phCachingImageManager] requestImageForAsset:_phAsset targetSize:CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT) contentMode:PHImageContentModeAspectFill options:imageRequestOptions resultHandler:^(UIImage *result, NSDictionary *info) {
142+
return [[[QMUIAssetsManager sharedInstance] phCachingImageManager] requestImageForAsset:_phAsset targetSize:PHImageManagerMaximumSize contentMode:PHImageContentModeAspectFill options:imageRequestOptions resultHandler:^(UIImage *result, NSDictionary *info) {
143143
if (completion) {
144144
completion(result, info);
145145
}

QMUIKit/QMUIComponents/ImagePickerLibrary/QMUIImagePickerPreviewViewController.m

+6-2
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,11 @@ - (void)zoomImageView:(QMUIZoomImageView *)imageView didHideVideoToolbar:(BOOL)d
210210
#pragma mark - 按钮点击回调
211211

212212
- (void)handleCancelPreviewImage:(QMUIButton *)button {
213-
[self.navigationController popViewControllerAnimated:YES];
213+
if (self.navigationController) {
214+
[self.navigationController popViewControllerAnimated:YES];
215+
} else {
216+
[self exitPreviewAutomatically];
217+
}
214218
if (self.delegate && [self.delegate respondsToSelector:@selector(imagePickerPreviewViewControllerDidCancel:)]) {
215219
[self.delegate imagePickerPreviewViewControllerDidCancel:self];
216220
}
@@ -365,7 +369,7 @@ - (void)requestImageForZoomImageView:(QMUIZoomImageView *)zoomImageView withInde
365369
}];
366370
} else {
367371
imageView.tag = -1;
368-
imageAsset.requestID = [imageAsset requestPreviewImageWithCompletion:^void(UIImage *result, NSDictionary *info) {
372+
imageAsset.requestID = [imageAsset requestOriginImageWithCompletion:^void(UIImage *result, NSDictionary *info) {
369373
// 这里可能因为 imageView 复用,导致前面的请求得到的结果显示到别的 imageView 上,
370374
// 因此判断如果是新请求(无复用问题)或者是当前的请求才把获得的图片结果展示出来
371375
dispatch_async(dispatch_get_main_queue(), ^{

QMUIKit/QMUIComponents/ImagePickerLibrary/QMUIImagePickerViewController.m

+19-2
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,20 @@ - (void)initPreviewViewControllerIfNeeded {
275275
self.imagePickerPreviewViewController = [self.imagePickerViewControllerDelegate imagePickerPreviewViewControllerForImagePickerViewController:self];
276276
self.imagePickerPreviewViewController.maximumSelectImageCount = self.maximumSelectImageCount;
277277
self.imagePickerPreviewViewController.minimumSelectImageCount = self.minimumSelectImageCount;
278+
if (!self.imagePickerPreviewViewController.customGestureExitBlock) {
279+
__weak __typeof(self)weakSelf = self;
280+
self.imagePickerPreviewViewController.customGestureExitBlock = ^(QMUIImagePreviewViewController *aImagePreviewViewController, QMUIZoomImageView *currentZoomImageView) {
281+
NSInteger index = [aImagePreviewViewController.imagePreviewView indexForZoomImageView:currentZoomImageView];
282+
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:index inSection:0];
283+
if ([weakSelf.collectionView.indexPathsForVisibleItems containsObject:indexPath]) {
284+
CGRect rect = [weakSelf.collectionViewLayout layoutAttributesForItemAtIndexPath:indexPath].frame;
285+
rect = [weakSelf.collectionView convertRect:rect toView:nil];
286+
[aImagePreviewViewController exitPreviewToRectInScreenCoordinate:rect];
287+
} else {
288+
[aImagePreviewViewController exitPreviewByFadeOut];
289+
}
290+
};
291+
}
278292
}
279293
}
280294

@@ -383,7 +397,10 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPa
383397
currentImageIndex:indexPath.item
384398
singleCheckMode:NO];
385399
}
386-
[self.navigationController pushViewController:self.imagePickerPreviewViewController animated:YES];
400+
401+
CGRect frame = [self.collectionViewLayout layoutAttributesForItemAtIndexPath:indexPath].frame;
402+
frame = [self.collectionView convertRect:frame toView:nil];
403+
[self.imagePickerPreviewViewController startPreviewFromRectInScreenCoordinate:frame];
387404
}
388405
}
389406

@@ -496,7 +513,7 @@ - (void)requestImageWithIndexPath:(NSIndexPath *)indexPath {
496513
// 发出请求获取大图,如果图片在 iCloud,则会发出网络请求下载图片。这里同时保存请求 id,供取消请求使用
497514
QMUIAsset *imageAsset = [self.imagesAssetArray objectAtIndex:indexPath.item];
498515
QMUIImagePickerCollectionViewCell *cell = (QMUIImagePickerCollectionViewCell *)[self.collectionView cellForItemAtIndexPath:indexPath];
499-
imageAsset.requestID = [imageAsset requestPreviewImageWithCompletion:^(UIImage *result, NSDictionary *info) {
516+
imageAsset.requestID = [imageAsset requestOriginImageWithCompletion:^(UIImage *result, NSDictionary *info) {
500517

501518
BOOL downloadSucceed = (result && !info) || (![[info objectForKey:PHImageCancelledKey] boolValue] && ![info objectForKey:PHImageErrorKey] && ![[info objectForKey:PHImageResultIsDegradedKey] boolValue]);
502519

QMUIKit/QMUIComponents/QMUIAlertController.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,13 @@ typedef NS_ENUM(NSInteger, QMUIAlertControllerStyle) {
7777
/**
7878
* `QMUIAlertController`是模仿系统`UIAlertController`的控件,所以系统有的功能在QMUIAlertController里面基本都有。同时`QMUIAlertController`还提供了一些扩展功能,例如:它的每个 button 都是开放出来的,可以对默认的按钮进行二次处理(比如加一个图片);可以通过 appearance 在 app 启动的时候修改整个`QMUIAlertController`的主题样式。
7979
*/
80-
@interface QMUIAlertController : UIViewController<QMUIModalPresentationComponentProtocol>
80+
@interface QMUIAlertController : UIViewController<QMUIModalPresentationComponentProtocol> {
81+
UIView *_containerView; // 弹窗的主体容器
82+
UIView *_scrollWrapView; // 包含上下两个 scrollView 的容器
83+
UIScrollView *_headerScrollView; // 上半部分的内容的 scrollView,例如 title、message
84+
UIScrollView *_buttonScrollView; // 所有按钮的容器,特别的,actionSheet 下的取消按钮不放在这里面,因为它不参与滚动
85+
UIControl *_maskView; // 背后占满整个屏幕的半透明黑色遮罩
86+
}
8187

8288
/// alert距离屏幕四边的间距,默认UIEdgeInsetsMake(0, 0, 0, 0)。alert的宽度最终是通过屏幕宽度减去水平的 alertContentMargin 和 alertContentMaximumWidth 决定的。
8389
@property(nonatomic, assign) UIEdgeInsets alertContentMargin UI_APPEARANCE_SELECTOR;

QMUIKit/QMUIComponents/QMUIDialogViewController.h

+54
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,65 @@
6262
@property(nonatomic, strong, readonly) QMUIButton *submitButton;
6363
@property(nonatomic, strong, readonly) CALayer *buttonSeparatorLayer;
6464

65+
/**
66+
添加位于左下角的取消按钮,取消按钮点击时默认会自动 hide 弹窗,无需自己在 block 里调用 hide。
67+
68+
同一时间只能存在一个取消按钮,所以每次添加都会移除上一个取消按钮。
69+
70+
@param buttonText 按钮文字
71+
@param block 按钮点击后的事件。取消按钮会自动 hide 弹窗,无需在 block 里调用 hide
72+
*/
6573
- (void)addCancelButtonWithText:(NSString *)buttonText block:(void (^)(__kindof QMUIDialogViewController *aDialogViewController))block;
74+
75+
/**
76+
移除当前的取消按钮
77+
*/
78+
- (void)removeCancelButton;
79+
80+
/**
81+
添加位于右下角的提交按钮
82+
83+
同一时间只能存在一个提交按钮,所以每次添加都会移除上一个提交按钮
84+
85+
@param buttonText 按钮文字
86+
@param block 按钮点击后的事件,如果需要在点击后关闭浮层,需要在 block 里自行调用 hide
87+
*/
6688
- (void)addSubmitButtonWithText:(NSString *)buttonText block:(void (^)(__kindof QMUIDialogViewController *aDialogViewController))block;
89+
90+
/**
91+
移除提交按钮
92+
*/
93+
- (void)removeSubmitButton;
94+
95+
/**
96+
用于展示 dialog 的 modalPresentationViewController
97+
*/
98+
@property(nonatomic, strong) QMUIModalPresentationViewController *modalPresentationViewController;
99+
100+
/**
101+
以动画形式显示弹窗,等同于 [self showWithAnimated:YES completion:nil]
102+
*/
67103
- (void)show;
104+
105+
/**
106+
显示弹窗
107+
108+
@param animated 是否用动画的形式
109+
@param completion 弹窗显示出来后的回调
110+
*/
68111
- (void)showWithAnimated:(BOOL)animated completion:(void (^)(BOOL finished))completion;
112+
113+
/**
114+
以动画形式隐藏弹窗,等同于 [self hideWithAnimated:YES completion:nil]
115+
*/
69116
- (void)hide;
117+
118+
/**
119+
隐藏弹窗
120+
121+
@param animated 是否用动画的形式
122+
@param completion 弹窗隐藏后的回调
123+
*/
70124
- (void)hideWithAnimated:(BOOL)animated completion:(void (^)(BOOL finished))completion;
71125

72126
@end

0 commit comments

Comments
 (0)