简体   繁体   中英

popViewController doesn't work in UITableViewController

I have a UITableViewController embedded in a UINavigationController. Calling self.navigationController popViewControllerAnimated:YES in didSelectRowAtIndexPath method has no effect.

My Main.storyboard looks like: UIViewController -> UINavigationController -> UITableViewController. How can I go back to UIViewController tapping on a UITableViewCell ?

popViewController dismisses 1 viewController from the navigationViewController's stack. Since your tableViewController is the only viewController in this stack, popping it wont do anything.

What you want to do is dismiss your navigationController, which is most likely presented modally. You can achieve this by calling dismissViewControllerAnimated

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