Iphone 目标c在摄像头中拍照
我正在使用phonegap Camera API,这是objective c的新版本,我不知道如何在.h文件中声明此函数的方法和接口Iphone 目标c在摄像头中拍照,iphone,ios,cordova,Iphone,Ios,Cordova,我正在使用phonegap Camera API,这是objective c的新版本,我不知道如何在.h文件中声明此函数的方法和接口 if([(NSString *) [components objectAtIndex:1] isEqualToString:@"Take_Photo"]) { UIImagePickerController *picker = [[UIImagePickerController alloc] init];
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];
}
我已在.h
文件中声明了UIImagePickerControllerDelegate
,但相机未打开。
我在调试应用程序时没有收到任何错误,在完成该行后暂停
[self presentModalViewController:picker animated:YES];
应用程序调试器在二进制文件中暂停。我想我在.h文件中遗漏了什么
@interface NativeAPI :UIViewController
<UIWebViewDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate>
{
Reachability* internetReachable;
Reachability* hostReachable;
UIImagePickerController* Image_Picker;
}
@接口NativeAPI:UIViewController
{
可达性*可互联;
可达性*主机可达性;
UIImagePickerController*图像选择器;
}
任何一位帮助我的人都要提前感谢您需要像这样将选择器的值分配给实例变量
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];
试试上面的代码
您可以在代理调用的实现下定义一个方法。在上面发布的代码中没有类似UIImageControllerDelegate的东西。请在此提供实现代码和头文件,以便建议解决方案。“但它不起作用”请更具体。什么不起作用?