我的相机按钮代表有什么问题?

时间:2013-12-28 22:56:42

标签: objective-c ios7 uiimagepickercontroller

我在集合视图控制器单元中创建了一个相机按钮来拍照,并将其输出到单元格大小的UIImageView。现在我与代表发生了错误,我不太确定它要我做什么。

enter image description here

- (IBAction)cameraButtonClicked:(id)sender {
    if (![UIImagePickerController isSourceTypeAvailable:(UIImagePickerControllerSourceTypeCamera)]) {
        UIAlertView *cameraAlertView = [[UIAlertView alloc] initWithTitle:@"Camera Not Available" message:@"There is no camera on this device which really defeats the purpose of this game. We suggest you get an iDevice with a camera." delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil];
        [cameraAlertView show];
    }else{
        //Show the Image Picker Controller Here
        UIImagePickerController * ipc = [[UIImagePickerController alloc] init];
        ipc.sourceType = UIImagePickerControllerSourceTypeCamera;
        ipc.allowsEditing = NO;
        //Set the Delegate
        ipc.delegate = self;

        [self.navigationController presentViewController:ipc animated:YES completion:nil];
    }
}

2 个答案:

答案 0 :(得分:3)

它告诉你self不符合UINavigationControllerDelegate和/或UIImagePickerControllerDelegate协议。你班上Implement those protocols

答案 1 :(得分:0)

您是否在标题中指定了UIImagePickerControllerDelegate协议?