Iphone UIImagepicker未显示在IPad情节提要中
由于我的应用程序有问题,我似乎对ios不太熟悉。我的项目包含一个rootViewAppDelegate、*rootViewController*和cameraViewController MyrootViewcontroller中实现了一个菜单类型代码,当按下按钮时,它会转到cameraViewController。MycameraViewController包含一个UIImagepickerIphone UIImagepicker未显示在IPad情节提要中,iphone,ios,xcode,ipad,Iphone,Ios,Xcode,Ipad,由于我的应用程序有问题,我似乎对ios不太熟悉。我的项目包含一个rootViewAppDelegate、*rootViewController*和cameraViewController MyrootViewcontroller中实现了一个菜单类型代码,当按下按钮时,它会转到cameraViewController。MycameraViewController包含一个UIImagepicker 在网上关于IPAD中的UIImagePickerUIImagePicker的教程之后,它说我应该在代理
在网上关于IPAD中的UIImagePickerUIImagePicker的教程之后,它说我应该在代理中粘贴部分代码。因此,我将其粘贴到rootViewAppDelegate中。当我运行项目时。摄像机控制器中未显示任何内容。我错过什么了吗?谢谢你的回复。没有所有的细节,我想发生的事情如下:
- rootViewAppDelegate不是UIImagepicker的委托-您可能不想将其设置为一个,因为它是“应用程序的”委托
- 因此,您看到的情况是,UIImagePicker没有可触发委托的对象
@interface cameraViewController : UIViewController <UIImagePickerControllerDelegate>
或者在InterfaceBuilder/Storyboard中,需要将UIImagePicker的委托属性连接到cameraViewController
这将知道cameraViewController是UIPicker的代理,并相应地触发它。因此我将为UIImagePickerController delegate创建另一个类?不一定-另一个类,例如,您的cameraViewController应该能够成为UIPicker的代理。UIPickerControllerDelegate本身就是iOS API的一部分。-看这个例子:;还有代表参考:没有必要。您的cameraViewController可以作为UIImagePickerController的代表;因此,它需要包含成为UIImagePickerControllerDelegate所需的方法-例如-(void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)信息示例代码位于之前发布的链接中-AgileArrior:
[self setDelegate:myCameraViewController];