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 08:47:14 -0700
On 10/25/2012 7:05 AM, Julius Oklamcak 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
Thanks for the information. I was off from iOS dev. for a while to focus
more on Mac and Windows.
However, I kept monitoring what were being added and changed in iOS SDK.
What is embarrassing is that Apple started to push some "guide line" (
if we think of them positively ) or "restriction" ( if we think of them
negatively ) and it broke things. For the specific line of code, I put
in my original message, I think it was wrong to assign
UIImagePickerController's view to other (Root) controller view at first.
I think so, not because it was not possible to do, but because it is
kind of against of idea that Apple introduced view controllers with and
the gut feeling how Apple people wanted us to use it.
Anyway, because presentModalViewController:animated is deprecated in iOS
6, i may need to use presetnViewControlle:animated:completion.
However, I also think the target iOS device can have iOS 4.x still. So,
I need to decide which one to sacrifice, the use of latest message or
target audience who doesn't upgrade their iOS to iOS 5.0+ yet. or
probably I can use some gestalt/introspection method to figure out
branch into to identical code utilizing different messages.
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:).
One thing I'm worry is that they customized the view so much that I have
to rearchitect overall programming structure.
The current code is in -videDidLoad. But it heavily depends on
rootController.view = UIImagePickerController.view assignment.
However, people just brought me this outsourced project because the
company which was contracted for this project was departed from us a
while ago. And they are saying it's urgent... I saw lots of s***dity in
the source code, where they even didn't release object properly; they
implemented -(id)init messages without calling its init of its super
class; I would like to zip my mouth....
Probably I need to consider addChildViewController also, because of this
line of explanation for "view" property in UIViewController.
"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."
Actually I tried it yesterday night, but it complaint that the view (
probably mean the view of UIImagePickerController ) doesn't support the
orientation the app is running. I would like to read View controller
guide line more calmly tonight...
Thank you.
Thank you for your help.
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