简体   繁体   中英

Changing the Parent View Controller's Background Color

I need to change the background color of a parent view controller in a flipside view controller. I use the following code to do this, which works fine in the iOS 4.3 Simulator, however, the background color will not change in the iOS 5.1 Simulator. What changed in iOS 5?

-(IBAction)red {
    self.parentViewController.view.backgroundColor = [UIColor redColor];
    [self.delegate flipsideViewControllerDidFinish:self];
}

I think that you want to use self.presentingViewController in iOS 5. (Note that this property is not available pre iOS 5).

Another option, assuming that your delegate is the presenting view controller, would be to change the backgroundColor through a delegate method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM