finding my UIViewController
finding my UIViewController
- Subject: finding my UIViewController
- From: Roland King <email@hidden>
- Date: Thu, 04 Aug 2011 00:07:40 +0800
- Resent-date: Thu, 04 Aug 2011 00:08:49 +0800
- Resent-from: Roland King <email@hidden>
- Resent-message-id: <email@hidden>
- Resent-to: Cocoa Developer <email@hidden>
I feel I've asked this question before but google doesn't think I have.
My code is dealing with a button press in a control on a UITableViewCell in a UITableView which is contained in another UIView subclass and on and up through several views until eventually there is a topmost UIView which was presented from a UIViewController subclass. I want the button press to pop up a modal UIImagePickerController which will eventually pick the image for the cell I'm in. To pop it up I need a UIViewController instance to pop it up from, and to pop it down again afterwards.
Is there any way to find, given a UIView, what the closest presenting UIViewController is?
I tried going the other way, used [ [ UIView window ] rootViewController ] to pop up the image picker, that pops it up fine, but popping it down leaves a black screen, not really surprising, that's not the UIViewController which was really the controller at the point I pushed it, that's the root one, there's a few on the stack after that. I wasn't able to find a way to navigate down the UIViewController stack to find the bottom one, even if I could it sounds a bit fragile.
Do I really need to pass the UIViewController down through why whole view hierarchy to my UITableViewCells so they know what to use for a modal popup and down; or crawl upwards superview by superview until I find one which perhaps implements some interface telling me it knows what the UIViewController which presented it was?
I must have missed a method somewhere which does this. This is iOS 4.x on the phone. _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
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