UINavigationBar 顶部的自定义徽标?
我已经阅读了大量有关完整自定义 UINavigationBar
背景的请求,但我想要的是在默认 UINavigationBar
上覆盖徽标而不是文本。最好,我想将其应用到名为 CustomNavigationBar 的 UINavigationBar 子类。
I've read plenty of requests about a full-on custom UINavigationBar
background, but what I want is to overlay a logo on the default UINavigationBar
instead of text. Preferably, I'd like to apply it to a subclass of UINavigationBar
called CustomNavigationBar.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
巧妙的技巧,影子。
如果您只想添加徽标而不是标题,那很简单。在您的 navigationItem 上设置 titleView,如下所示:
Neat tricks, Shadow.
If you just want to add a logo instead of a title, that's easy. Set the titleView on your navigationItem, like so:
此页面有一些代码您可以查看,因为他解释了如何对导航控制器执行一些自定义操作。
http://web.archive.org/web/20161220074043/http://foobarpig.com/iphone/uinavigationbar-with-solid-color-or-image-background.html
这是另一个参考出色地。
http://web.archive.org/web/20120815192006/http://www.developers-life.com/custom-uinavigationbar-with-image-and-back-button.html
This page has some code you can look at as he explains how to do some custom things to the nav controller.
http://web.archive.org/web/20161220074043/http://foobarpig.com/iphone/uinavigationbar-with-solid-color-or-image-background.html
Here is another reference as well.
http://web.archive.org/web/20120815192006/http://www.developers-life.com/custom-uinavigationbar-with-image-and-back-button.html