开发者

How can I create a button that takes me back to a previous view?

开发者 https://www.devze.com 2023-01-30 20:34 出处:网络
In my current iPhone application, I开发者_JAVA百科 have four views.I would like to move from the first view to any of the three other views.

In my current iPhone application, I开发者_JAVA百科 have four views. I would like to move from the first view to any of the three other views.

In one of these second views, how would I create a button that takes me back to the first view?


I suggest using a UINavigationController:

http://developer.apple.com/library/ios/#documentation/uikit/reference/UINavigationController_Class/Reference/Reference.html

http://www.idev101.com/code/User_Interface/UINavigationController/


Also if you have a button that is not on the navbar that you want to act as your "back" button, you can always pop the current view. Something like

- (IBAction)back:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

This should work on a UIViewController which is on top of a UINavigationController.

0

精彩评论

暂无评论...
验证码 换一张
取 消