gpt4 book ai didi

objective-c - 为什么我第二次按下 View 时后退按钮没有出现?

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:54:10 26 4
gpt4 key购买 nike

每次单击图片时,我都会调用此方法(将 View 推送到详细 View ):

-(IBAction) loadTeamView:(id)sender {
teamView = [[TeamViewController alloc] initWithNibName:@"TeamViewController" bundle:nil detailItem:self.detailItem];
[self.navigationController pushViewController:teamView animated:YES];
}

它有效,但如果您单击后退按钮(自动出现)然后返回此方法,则不会显示后退按钮。有什么想法吗?

最佳答案

确保您没有更改 View Controller 的 navigationItem 属性的内容。根据文档,导航 Controller 遵循左侧导航栏按钮的以下规则:

The bar button item on the left side of the navigation bar allows for navigation back to the previous view controller on the navigation stack. The navigation controller updates the left side of the navigation bar as follows:

  1. If the new top-level view controller has a custom left bar button item, that item is displayed. To specify a custom left bar button item, set the leftBarButtonItem property of the view controller’s navigation item.
  2. If the top-level view controller does not have a custom left bar button item, but the navigation item of the previous view controller has a valid item in its backBarButtonItem property, the navigation bar displays that item.
  3. If a custom bar button item is not specified by either of the view controllers, a default back button is used and its title is set to the value of the title property of the previous view controller—that is, the view controller one level down on the stack. (If there is only one view controller on the navigation stack, no back button is displayed.)

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

关于objective-c - 为什么我第二次按下 View 时后退按钮没有出现?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8690408/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com