Re: [Q] a view is associated with more than one view controller?
Re: [Q] a view is associated with more than one view controller?
- Subject: Re: [Q] a view is associated with more than one view controller?
- From: JongAm Park <email@hidden>
- Date: Thu, 25 Oct 2012 09:02:10 -0700
On 10/25/2012 7:18 AM, Roland King wrote:
On 25 Oct, 2012, at 10:05 PM, Julius Oklamcak <email@hidden
<mailto:email@hidden>> wrote:
If anyone knows how to solve this problem, please show me your guidance.
From some work I did earlier this year for a client,
UIImagePickerController
needs to be presented modally or in a UIPopoverController. It also
doesn't
handle being a root view controller very well
(window.rootViewController =
imagePickerController).
Without going the route of using the various AV Foundation APIs to
implement
your own camera controller class, the solution I used was to present the
UIImagePickerController modally in the root view controller's
-viewDidAppear: method (you could try in -viewWillAppear:).
That is all true - on top of that, after introducing view controller
containment in iOS5 to give people a proper way of doing what was
always not recommended, taking a view from ViewController B and
slapping it into ViewController A, iOS 6 is finally strict about it.
You just can't do this any more.
That's good. :)
I don't like people who just write code which just looks to work because
their managers or people at asked-company-if-contracted don't know about
programming.
I have seen so many people in Windows and Mac, and now even in iPhone
world who didn't understand paradigm of a framework and just write code
without knowing that it violated the paradigm. When something doesn't
abide by the paradigm, it may work now, but can break seriously soon.
Also, it's highly possible that it is not even properly implemented.
What I'm saying is just like this : a guy just implemnted 1+1 = 2 like :
1 + (uh... i don't know what to do ) + 2 + 3 - 3 - 1 (hmm.. it looks
working.. ) = 1
However, welll... cruel world. I got such source code on my hand.
If you want to mix views from different VCs on the screen, you now
*must* use View Controller Containment (and that's the right thing to
look for in the documentation).
The advice above about UIImagePickerController is I believe also true,
that thing really wants to be modal (I hope they change that one day).
by using.. like.. addChildViewController: right?
I found this explanation in Apple's document. ( view property in
UIViewController class reference. )
"Each view controller object is the sole owner of its view. You must not
associate the same view object with multiple view controller objects.
The only exception to this rule is that a container view controller
implementation may add this view as a subview in its own view hierarchy.
Before adding the subview, the container must first call its
|addChildViewController:
<http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instm/UIViewController/addChildViewController:>|
method to create a parent-child relationship between the two view
controller objects."
It sounds like that if I add UIImagePicker controller using
addChildViewController:, it's possible to set the view of a root view
controller to the view of UIImagePicker. but it didn't work last night.
Probably I missed something. I would like to read their document more.
There are a few things I would like to try (again) :
1. |presentViewController:animated:completion:
<http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instm/UIViewController/presentViewController:animated:completion:>
2. addChildViewController:
What do you think about it?
I'm switching to Windows mode by launching Visual Studio... :(
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