[Q] a view is associated with more than one view controller?
[Q] a view is associated with more than one view controller?
- Subject: [Q] a view is associated with more than one view controller?
- From: JongAm Park <email@hidden>
- Date: Wed, 24 Oct 2012 23:59:18 -0700
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 (email@hidden)
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:
This email sent to email@hidden