问题描述
我的问题是我的NavigationItem中的RightBarButtonItem在视图第二次出现后消失了.第一次加载视图时,它会正确显示,但是第二次完全消失.
My problem is that my RightBarButtonItem, in my navigationItem, disappears after the view appears a second time. The first time the view loads, it displays properly, but the second time it disappears completely.
该按钮在viewWillAppear中的初始化如下:
The button is init'd in viewWillAppear as such:
UIBarButtonItem *optionsButton = [[UIBarButtonItem alloc] initWithCustomView:roundedButton];
self.navigationItem.rightBarButtonItem = optionsButton;
我记得叫超级
我只再次触摸导航控制器:
I only touch my navigation controller once more:
有什么想法可能会发生这种情况吗?
Any ideas how this might be happening?
推荐答案
您可以使用类别在导航栏上添加自定义图像.通过在导航栏上创建类别来覆盖drawRect方法.在Google上搜索,您会找到它.如果没有让我知道.我帮你做.
you can use a category to add custom image on navigation bar. Override drawRect method by creating a category on navigation bar. Search on google you will find it. If not let me know. I'll do it for you.
这篇关于当再次出现视图时,RightBarButtonItem消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!