从导航项中删除右侧栏按钮项

从导航项中删除右侧栏按钮项

本文介绍了从导航项中删除右侧栏按钮项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已在我的导航项目中添加了一个右侧栏按钮项,并希望在某些条件下删除此项。这是我在做什么:

I have added a right bar button item in my navigation item and want to remove this on some condition. This is what I am doing:

self.navigationItem.rightBarButtonItem = nil;

但无法获得所需的行为。

But not getting the desired behavior.

我想隐藏它,但没有找到任何方法。

I want to hide it but do not find any method for it.

推荐答案

我做了很多次。您确定要从正确的导航项目中删除按钮吗?是 self 当前显示的 UIViewController

What you're doing should work. I've done that lots of times. Are you sure you're removing the button from the correct navigation item? Is self the currently displayed UIViewController?

这篇关于从导航项中删除右侧栏按钮项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 09:21