問題描述:
當(dāng)UIImagePickerControlle屬性allowsEditing設(shè)置為YES時(shí),在編輯/選取圖片的時(shí)候,卻發(fā)現(xiàn)左下角的那個(gè) 取消 按鍵非常的難點(diǎn)擊。
原因:
視圖調(diào)試和使用測(cè)試控件,如圖能看到在左側(cè)有一個(gè)未知來(lái)源的透明的View控件,尺寸(height為屏幕高,寬度在iphone6下為13、Plus以上為41.4),其遮擋了cancelButton。
問題如圖:

Simulator Screen Shot - iPhone 6 Plus - 2018-09-21 at 10.43.20.png
解決辦法:
1.實(shí)現(xiàn)代理:UINavigationControllerDelegate、 xxx.delegate = self;
2.實(shí)現(xiàn)方法:
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
if ([UIDevice currentDevice].systemVersion.floatValue < 11) {
return;
}
if ([viewController isKindOfClass:NSClassFromString(@"PUPhotoPickerHostViewController")]) {
[viewController.view.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (obj.frame.size.width < 42) {
[viewController.view sendSubviewToBack:obj];
*stop = YES;
}
}];
}
}