自定义 UINavigationController UINavigationBar
基本上我想要一个自定义的UINavigationBar
。我不希望它是“半透明”或任何东西,就像图片应用程序一样。
我基本上想完全删除它,但我仍然希望能够在推送导航控制器时添加后退按钮等,并且我希望将视图(EG:UITableViewController
)推到其下方。
像这样:
有什么想法可以实现这一点吗?
谢谢
Basically I want a custom UINavigationBar
. I don't want it to be "translucent" or anything, like the pictures app.
I basically want to completely remove it, but I still want to be able to add back buttons and such when navigation controllers are pushed, and I want the views (EG: UITableViewController
) to be pushed down below it.
Like this:
Any ideas how to achieve this at all?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
基本上,它并没有完全透视——这是一个视觉谎言。实际执行此操作的唯一方法是重写
UINavigationBar
的drawRect:
方法,如上所示。basically, its not completely see through - its a visual lie. The only way to do it realistically is to override
UINavigationBar
'sdrawRect:
method, as shown above.要查看
UINavigationBar
,如果您选择使用 UINavigationBar,只需:如果您希望它看起来像您发布的图像,则必须更改色调/颜色以匹配背景。
To see through the
UINavigationBar
, if you choose to have one, just:You'll have to change the tint/color to match the background if you want it to appear like the image you posted.
在您的
AppDelegate
子类UINavigationBar
的开头,如下所示:然后在
AppDelegate
中执行此魔术:这应该给您更多的控制权
UINavigationController
外观&感觉。At the beginning of your
AppDelegate
subclassUINavigationBar
as below:and then in the
AppDelegate
do this magic:That should give you a lot more control over
UINavigationController
look & feel.很难说,可能是
UINavigationBar
存在并且颜色与UIView
背景匹配,或者没有UINavigationBar
,只是一个带有自定义按钮的视图和顶部的UILabel
。选择一种方法并对其进行编码,或者再次提出更具体的问题。Hard to tell, could be the
UINavigationBar
is there and color matches theUIView
background or, there is noUINavigationBar
, just a view with custom buttons andUILabel
on top. Pick an approach and code it, or ask the question again with more specifics.