2010-08-16 70 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不太可能做正確的事情。