I would like to reset the state of a UISwitch in a UIPopoverController from my MainViewController. I assume a simple
popoverView.switchName.on = NO;
wont do the job (as it doesnt seem to 开发者_高级运维be working). Whats the best way to do this? Thank you.
The UIPopoverController is the container for the content view controller that is shown inside the frame. I assume at some point you are calling initWithContentViewController with a view controller that presents the content and that this view controller has the switchName property.
To access this view controller you can use the contentViewController property of the UIPopoverController. I imagine it will be something like:
// assuming popoverView is a UIPopoverController and that the type of
// the view contorller you pass to initWithContentViewController is YourViewController
YourViewController * myController = (YourViewController*)popoverView.contentViewController;
myController.switchName.on = NO;
精彩评论