UIImagePickerController how to hide the flip camera button?

前端 未结 2 1285
情话喂你
情话喂你 2021-01-06 09:18

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

thanks for reading !^_^!

2条回答
  •  生来不讨喜
    2021-01-06 09:30

    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
    

提交回复
热议问题