2018-05-29

iOS 11 ,如果给 UIImagePickerController 设置 allowsEditing = YES,然后在编辑图片的时候,却发现左下角的那个 取消 按键怎么也没法点击到

让你的类实现 UINavigationControllerDelegate 接口,然后实现这个方法:

- (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;
            }
        }];
    }
}

你可能感兴趣的:(2018-05-29)