Iphone 为什么我的UIButton没有复制我的相机视图?

Iphone 为什么我的UIButton没有复制我的相机视图?,iphone,camera,Iphone,Camera,我已经看了好几天了 - (void)viewDidAppear:(BOOL)animated { #if !TARGET_IPHONE_SIMULATOR UIButton *returnButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; returnButton.frame = CGRectMake(0, 0, 100, 100); [returnButton setTitle:@"Tap her

我已经看了好几天了

- (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];
}

我认为您需要先使用以下命令隐藏损坏的摄像头控件:
[[self-cameraController]setShowsCameraControls:NO]

此属性的默认值为“是”,指定默认摄影机控件在拾取程序中可见。如果要使用cameraOverlayView属性提供自定义覆盖视图,请将其设置为“否”,以隐藏默认控件


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