0

我正在使用新的目标 ci 的 phonegap Camera API 不知道如何在 .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;
    }

任何人帮助我提前谢谢

4

1 回答 1

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

试试上面的代码

您可以在实现下定义一个由委托调用的方法。

于 2012-05-23T09:12:21.243 回答