Change detail view from MasterDetail iPad app using storyboard

若如初见. 提交于 2019-12-03 11:18:54

I'll suggest you to use a replace segue.

Just create a segue to the desired view initiated by your row with a Style: Replace, and Destination: Detail Split.

Segues were introduced in the iOS 5 SDK

EDIT:

These are step-by-step instructions to accomplish what you need. From now on:

  • the item that should be pressed for the action to take place (a button or row in master view) = *Button;
  • the view you want to be placed in the iPad's detail view = *Detail.

just a bit for naming for ease of explanation

  1. Hold ctrl click on *Button then hold and drag to *Detail and release to create your segue.
  2. In the popup pick Replace
  3. Select your segue, open Attributes inspector and set Destination to Detail Split

That's all.

More on segues: http://www.scott-sherwood.com/?p=219

Specifically, in CS193P, check out the latest version, and look at lecture #7. Paul doesnt finish the part with the replace Segue, but he DOES provide an example with very good reusable code (Psychologist with Dr Pill)

If you are using a dynamic tableview in your MasterViewController, implement numberOfRowsInSection:(NSInteger)section Method with:

return [_youDataArrayNameHere count];

then on cellForRowAtIndexPath configure the cell:

cell.textLabel.text = [_youDataArrayNameHere  objectAtIndex:indexPath.row];

and in didSelectRowAtIndexPath, call any other view based on the selected row:

//
if (indexPath.row == 0) {
     [_detailViewController.navigationController pushViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"anotherVC01Here"] animated:YES];
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!