且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

UIImagePickerController如何隐藏翻转相机按钮?

更新时间:2023-11-09 23:22:34

我最终使用UIImagePickerController的自定义子类来修复这个问题和其他问题:

I ended up using a custom subclass of UIImagePickerController to fix this (and other) issues:

#import "SMImagePickerController.h"

@implementation SMImagePickerController

void hideFlipButtonInSubviews(UIView *view) {
    if ([[[view class] description] isEqualToString:@"CAMFlipButton"]) {
        [view setHidden:YES];
    } else {
        for (UIView *subview in [view subviews]) {
             hideFlipButtonInSubviews(subview);
        }    
    }    
}    

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];

    hideFlipButtonInSubviews(self.view);
}    

@end