MSU*_*dog 2 xcode uisplitview uisplitviewcontroller ios uisplitviewdelegate
I have a home page and when a certain button is pressed, it takes you to a split view with a table on the left (master) side and a view showing details on the right (detail) side. The app is working fine on the simulator, but when I run on my iPad mini I get an error.
When the user clicks on a table cell in the left (master) view, I call:
DetailViewController *detail = [self.storyboard instantiateViewControllerWithIdentifier:@"detailViewController"];
detail.jobInfo = [_fetchedResultsController objectAtIndexPath:indexPath];
[self.splitViewController showDetailViewController:detail sender:self];
Run Code Online (Sandbox Code Playgroud)
That updates the detail view in the simulator, but crashes and gives me the following error on a device:
'-[UISplitViewController showDetailViewController:sender:]: unrecognized selector sent to instance'
Run Code Online (Sandbox Code Playgroud)
Any suggestions on how to fix this?
要直接更新viewControllers属性,请执行以下操作:
NSArray *vcs = @[self.splitViewController.viewControllers[0],detail];
self.splitViewController.viewControllers = vcs;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2073 次 |
| 最近记录: |