0

Having problem with my application, I seem to be new in ios. My project contains a rootViewAppDelegate,*rootViewController*,and cameraViewController.

My rootViewcontroller has a Menu type code implemented in it that when a button is pressed it goes to cameraViewController.My cameraViewController contains a UIImagepicker.

In following a tutorial in the net about UIImagePicker in IPAD, it says there that I should paste some part of the code in the delegate. So I pasted it in the rootViewAppDelegate. When I run the project. Nothing is displaying in the cameraViewController. Did I miss something wrong? Thanks for reply.

4

1 回答 1

1

没有所有细节,我认为正在发生的事情如下:

  • rootViewAppDelegate 不是您的 UIImagepicker 的代表 - 您可能不想将其设置为一个,因为它是“应用程序的”代表
  • 所以你看到发生的是你的 UIImagePicker 没有对象来触发委托

可能需要做的是使用您的 cameraViewController 作为 UIImagePicker 委托 - 为此,您需要进入您的:cameraViewController 并将其设置为 UIImagePickerDelegate 协议的追随者:

@interface cameraViewController : UIViewController <UIImagePickerControllerDelegate>

然后在您的 UIImagePicker 中,您需要将委托设置为 cameraViewController - 如果您有 UIImagePicker 的源文件,您可以在代码中执行此操作,方法如下:

[self setDelegate:myCameraViewController];

或者在 InterfaceBuilder/Storyboard 中,您需要将 UIImagePicker 的委托属性连接到 cameraViewController。

这将知道 cameraViewController 是 UIPicker 的委托并适当地触发它。

于 2012-05-08T04:07:17.113 回答