2010-08-16 71 views
0

一直在寻找这几天..为什么我的UIButton不能显示我的cameraOverlayView?

- (void)viewDidAppear:(BOOL)animated { 


#if !TARGET_IPHONE_SIMULATOR 

    UIButton *returnButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 
    returnButton.frame = CGRectMake(0, 0, 100, 100); 
    [returnButton setTitle:@"Tap here to return" forState:UIControlStateNormal]; 
    [returnButton addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside]; 
    [self.view addSubview:returnButton]; 
    [self.view bringSubviewToFront:returnButton]; 

    [[self cameraController] setCameraOverlayView:[self view]]; 
    [self presentModalViewController:[self cameraController] animated:YES]; 
    [[self view] setFrame:[[[self cameraController] view] bounds]]; 
#endif 

    [super viewDidAppear:animated]; 
} 

回答

0

我认为你需要使用第一隐藏defaul摄像机控制:[[self cameraController] setShowsCameraControls:NO]See more here

此属性的默认值为YES,指定默认摄像机控件在选取器中可见。如果您想使用cameraOverlayView属性提供自定义叠加视图,请将其设置为NO以隐藏默认控件。

0

[[self cameraController] setCameraOverlayView:[self view]];几乎肯定是错的。当调用viewDidAppear:时,您的视图已经在视图层次结构中。突然将它设置为cameraOverlayView不太可能做正确的事情。