我正在使用phonegap Camera API新目标c我不知道如何在.h文件中声明此函数的方法和接口
if([(NSString *) [components objectAtIndex:1] isEqualToString:@"Take_Photo"])
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsImageEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:picker animated:YES];
}
我已在UIImagePickerControllerDelegate
文件中声明.h
,但相机未打开。
当我完成行
[self presentModalViewController:picker animated:YES];
应用程序调试器暂停在二进制文件中。我想我错过了.h文件中的内容。
@interface NativeAPI :UIViewController
<UIWebViewDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate>
{
Reachability* internetReachable;
Reachability* hostReachable;
UIImagePickerController* Image_Picker;
}
任何人都提前帮助我
答案 0 :(得分:0)
您需要将选择器的值分配给实例变量,如下所示。
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
self.Image_picker = picker;
[picker release];
Image_picker.delegate = self;
Image_picker.allowsImageEditing = YES;
Image_picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:picker animated:YES];
尝试上面的代码
您可以在代理调用的实现下定义一个方法。