iPhone UINavigationController 问题(按钮、标题不可见)
我的 UINavigationController 有两个问题。
问题 1
在初始视图中,我以编程方式添加了一个 rightBarButtonItem。
当我将导航视图推到右侧时,一切正常,并且出现一个带有上一个视图标题的后退按钮。
当我点击后退按钮时,我就回来了。但后来这个按钮就消失了。但它并没有真正消失,它只是不可见,因为它仍然可以被单击。
问题2
当我推送右侧的viewController时,无法设置标题。我在推送视图之前尝试过
myViewController.title = @"someTitle";
,并且也在 viewController 内部尝试过,
self.title = @"someTitle";
但这里没有任何效果。
I have two problems with the UINavigationController.
Problem 1
On the initial view I programmatically added a rightBarButtonItem.
When I push the navigationView to the right, everything works right and it appears a back button with the title of the previous view.
When I click the back button, I get back. But then this button is gone. But it's not really gone, it's just invisible, because it can still be clicked.
Problem 2
When I push the viewController on the right, I can't set the title. I tried it before pushing the view with
myViewController.title = @"someTitle";
and I tried it also inside of the viewController with
self.title = @"someTitle";
but nothing works here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我发现问题:
我正在向导航栏添加自定义背景图像。不知何故,这张图片超出了标题/按钮。
因此,如果您想实现自定义背景图像,不要使用此:
而是使用此:
I found the problem:
I was adding a custom background image to the navigationBar. Somehow this image got over the title / button.
So if you ever want to implement a custom background image, don't user this:
But instead, use this:
问题一:
听起来很奇怪。确实没有答案:-/
问题 2:
您能否提供更多关于此的代码片段,例如您尝试设置标题的整个方法主体?
Problem 1:
Sounds odd. Don't really have an answer for that :-/
Problem 2:
Can you provide some more code snippets on this, like the whole method bodies where you tried to set the title?