如何隐藏iPhone导航栏上的“后退”按钮?

本文翻译自:How to hide 'Back' button on navigation bar on iPhone?

I added a navigation control to switch between views in my app. 我添加了一个导航控件,可以在我的应用中切换视图。 But some of the views shouldn't have 'Back' (the previous title) button. 但有些观点不应该有“后退”(前一个标题)按钮。 Any ideas about how to hide the back button? 有关如何隐藏后退按钮的任何想法?


#1楼

参考:https://stackoom.com/question/2Zme/如何隐藏iPhone导航栏上的-后退-按钮


#2楼

使用代码:

 self.navigationItem.backBarButtonItem=nil;

#3楼

The best way is to combine these, so it will hide the back button even if you set it up manually : 最好的方法是组合这些,所以即使你手动设置它也会隐藏后退按钮:

self.navigationItem.leftBarButtonItem=nil;
self.navigationItem.hidesBackButton=YES;

#4楼

hide back button with bellow code... 用波纹管代码隐藏后退按钮...

[self.navigationItem setHidesBackButton:YES animated:YES];

or 要么

[self.navigationItem setHidesBackButton:YES];

Also if you have custom UINavigationBar then try bellow code 此外,如果你有自定义UINavigationBar然后尝试下面的代码

self.navigationItem.leftBarButtonItem = nil;

#5楼

在UIViewController的函数viewDidLoad中使用代码:

self.navigationItem.hidesBackButton = YES;

#6楼

In Swift : Swift中

Add this to the controller 将其添加到控制器

override func viewDidLoad() {
    super.viewDidLoad()
    self.navigationItem.setHidesBackButton(true, animated: false)
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值