UIImagePickerController 編輯/選取圖片時(shí)的左下角取消按鍵難點(diǎn)擊的問題

問題描述:

當(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;
    }
    }];
    }
    }
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容