2012-05-23 301 views
0

我在PhoneGap的摄像头API工作的新目标词不知道如何在.h文件中目标C拍摄照片

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

在上面的代码中没有像UIImageControllerDelegate这样的东西。请在此提供实现和头文件的代码,以便可以提出解决方案。 –

+0

看到我编辑的代码..“ –

+0

”但它没有工作“请更具体。什么没有奏效? – jimpic

回答

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

尝试上述

的代码可以是由代表被调用的执行下定义的方法。