没有可见的@interface不调试

时间:2013-07-15 07:17:00

标签: ios objective-c

 -(IBAction)TakePhoto {
picker = [[UIImagePickerController alloc]init];
picker.delegate = self;
[picker setSourceType:UIImagePickerControllerSourceTypeCamera];
[self presentedViewController:picker animated:YES completion:nil];
}

- (IBAction)ChooseExisting {
picker2 = [[UIImagePickerController alloc]init];
picker2.delegate = self;
[picker2 setSourceType:UIImagePickerControllerSourceTypeCamera];
[self presentedViewController:picker2 animated:YES completion:nil];
}

- (void) imagePickerController:(UIImagePickerController *)picker    didFinishPickingMediaWithInfo:(NSDictionary *)info {
image = [info objectForKey:UIImagePickerControllerOriginalImage];
[imageview setImage:image];
[self dismissViewControllerAnimated:YES completion:nil];

}
  - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
[self dismissViewControllerAnimated:YES completion:NULL];

当我尝试运行此应用时,我

[self presentedViewController:picker animated:YES completion:nil];

以红色突出显示说明ViewController没有可见的@interface声明扇区presentviewcontroller:animated:completion:

我的.h文件是

@interface ViewController : UIViewController <UIImagePickerControllerDelegate,
UINavigationControllerDelegate> {
UIImagePickerController *picker;
UIImagePickerController *picker2;
UIImage *image;
IBOutlet UIImageView *imageview;

}

- (IBAction)TakePhoto;
- (IBAction)ChooseExisting;

1 个答案:

答案 0 :(得分:2)

您的行上有一个拼写错误:presentedViewController而不是presentViewController

[self presentedViewController:picker animated:YES completion:nil];

(在多个地方)