Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIImagePickerController how to hide the flip camera button?

is there a way to hide the flip camera button inside the UIImagePickerController?

thanks for reading !^_^!

like image 228
xiaowoo Avatar asked Jan 17 '23 08:01

xiaowoo


1 Answers

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
like image 127
Travis Luckenbaugh Avatar answered Feb 17 '23 21:02

Travis Luckenbaugh