Why not just add the camera view as sub view of the root ? 

from my  iPhone

在 2012-10-25,下午2:59,JongAm Park <jongamp...@sbcglobal.net> 写道:

> Hello,
> 
> I'm having a problem while rebuilding old project which was made with iOS 3.x 
> SDK at first.
> Currently I'm building it with iOS 6.0 SDK and can be targeted for 4.3.
> 
> There is a central controller, RootViewController.
> And when the app is loaded, it creates an instance of UIImagePickerController.
> And finally, it tries to assign the view of UIImagePickerController, i.e. 
> imagePickerController.view, to the RootViewController's view.
> 
> Brief code lines are like this.
> 
> if([UIImagePickerController 
> isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) 
> {
>    self.camera = [[UIImagePickerController alloc] init];
>    [self.camera setSourceType:UIImagePickerControllerSourceTypeCamera];
>    self.camera.allowsEditing = NO;
>    self.camera.navigationBarHidden = YES;
>    self.camera.toolbarHidden = YES;
>    self.camera.wantsFullScreenLayout = YES;
> 
>    ...
> 
>    self.view == self.camera.view; // This is where it throws the exception.
>    // self is RootViewController
> 
> The error message is this :
> 
> A view can only be associated with at most one view controller at a time! 
> View <UILayoutContainerView: 0x1ddbee60; frame = (0 0; 320 480); autoresize = 
> W+H; layer = <CALayer: 0x1ddbeed0>> is associated with 
> <UIImagePickerController: 0x1dd510b0>. Clear this association before 
> associating this view with <RootViewController: 0x1dd32f20>. : A view can 
> only be associated with at most one view controller at a time! View 
> <UILayoutContainerView: 0x1ddbee60; frame = (0 0; 320 480); autoresize = W+H; 
> layer = <CALayer: 0x1ddbeed0>> is associated with <UIImagePickerController: 
> 0x1dd510b0>. Clear this association before associating this view with 
> <RootViewController: 0x1dd32f20>.
> 
> The UILayoutContainerView: 0x1ddbee60 is self.camera.view.
> 
> According to this StackOverFlow page, its sounds like that it was possible to 
> assign a view controller's view to other controller's view with previous iOS 
> SDK, but looks to be changed recently.
> 
> Does Apple recommend other approach to achieve the same goal?
> If anyone knows how to solve this problem, please show me your guidance.
> 
> Thank you.
> JongAm Park
> 
> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/tianbaom%40gmail.com
> 
> This email sent to tianb...@gmail.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to