How do I reference the detailViewController on an iPad that is using a splitViewController

前端 未结 3 463
不思量自难忘°
不思量自难忘° 2021-01-24 20:07

I setup a project on XCode 4.3 and IOS 5 without using storyboards for both iPhone and iPad using the default Master/Detail setup from the create new project dialog.

The

3条回答
  •  野的像风
    2021-01-24 20:46

    In the master/detail template, Apple uses the following code in the MasterViewController (i.e. the one on the left):

    - (void)viewDidLoad {
        [super viewDidLoad];
        self.detailViewController = (MYDetailViewController *)[[self.splitViewController.viewControllers lastObject] topViewController];
    }
    

    With the property on MasterViewController defined as:

    @property (strong, nonatomic) MYDetailViewController *detailViewController;
    

提交回复
热议问题