我正在做一些相当简单的事情。我用一个分段控件创建了一个简单的NIB。主要用于测试目的。 我正在尝试使用此NIB加载到UIImagePickerController叠加层。但加载后,叠加层不透明。只需在摄像机视图顶部的中央显示白色背景和按钮即可。我试过overlay.opaque = NO没有运气。
这是我的代码:
@property (nonatomic) IBOutlet UIView *viewTest;
@property (nonatomic, weak) IBOutlet UISegmentedControl *switchButtonTest;
稍后,我有这个方法(主要来自Apple的APLViewController示例
- (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];
}
答案 0 :(得分:1)
要摆脱白色背景视图,请将其颜色更改为clearColor
(或者首先不要使用它)。要使分段控件不那么透明,请将其alpha
设置为0.2
。
答案 1 :(得分:0)
在self.viewTest背景中填充清晰的颜色。