Question

I have a UITableView in which I want to let user to click on the cell and use a sub view to display the detail information. I have tried this method:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

SubMainViewController __autoreleasing *mSubView = [self.storyboard instantiateViewControllerWithIdentifier:@"mainSubView"];
[self presentViewController:mSubView animated:YES completion:nil];

}

This seems to be working, however, I couldn't get back to my table view, could anyone help me out?

Was it helpful?

Solution

Well it seems you want to load a detailview when user selects a cell and you want the user to be able go back to the previously view when back or some button like that is pressed. You need to use navigation controller for that. Here is the link to apple's doc http://developer.apple.com/library/ios/ipad/#documentation/UIKit/Reference/UINavigationController_Class/Reference/Reference.html

And here is a sample tutorial to get you started

http://razell.hubpages.com/hub/IPhone-Guide-Loading-a-detail-view

Hope this helps, let me know if you need any more help.

EDIT:

So according to your comment you are looking for a modal view to pop up over the view. Well here is a link to whole a lot of different ways to achieve that, and they all have example projects too so you can actually see how the trick is executed.

http://samwize.com/2012/12/06/7-ios-custom-popup-views/

OTHER TIPS

In your SubMainViewController you need to dismiss the your current viewcontroller using

[self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top