I'm doing something fairly simple. I created a simple NIB with just a segmented control. Mainly for test purposes. I'm trying to use this NIB to load into a UIImagePickerController overlay. But when loaded, the overlay is not transparent. Simply showing the white background and the button in the center on top of the camera view. I tried overlay.opaque = NO with no luck.
Here is my code:
@property (nonatomic) IBOutlet UIView *viewTest;
@property (nonatomic, weak) IBOutlet UISegmentedControl *switchButtonTest;
Later on, I have this method (mainly from the APLViewController example from apple
- (void)showImagePickerForSourceType:(UIImagePickerControllerSourceType)sourceType
{
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
imagePickerController.sourceType = sourceType;
imagePickerController.delegate = self;
if (sourceType == UIImagePickerControllerSourceTypeCamera)
{
imagePickerController.showsCameraControls = NO;
[[NSBundle mainBundle] loadNibNamed:@"ViewTest" owner:self options:nil];
self.viewTest.frame = imagePickerController.cameraOverlayView.frame;
imagePickerController.cameraOverlayView = self.viewTest;
self.viewTest = nil;
}
self.imagePickerController = imagePickerController;
[self presentViewController:self.imagePickerController animated:YES completion:nil];
}
To get rid of the white background view, change its color to clearColor
(or don't use it in the first place). To make the segmented control less opaque, set its alpha
to, say, 0.2
.