Swift导航栏图像标题 [英] Swift Navigation Bar Image Title
本文介绍了Swift导航栏图像标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
几个星期前我开始使用Swift编程。现在我想自定义我的Apps Look。我想使用徽标图像作为导航栏标题而不是明文。
I started Programming in Swift a couple Weeks ago. Now I want to customize my Apps Look. I want to use a Logo Image as Navigation Bar Title instead of a Plaintext.
let logo = UIImage(named: "logo.png")
self.navigationItem.titleView = logo;
我收到错误UIImage无法转换为UIView
我google了很多。但没办法:(
I googled a lot. But no way :(
推荐答案
把它放在 UIImageView
let logo = UIImage(named: "logo.png")
let imageView = UIImageView(image:logo)
self.navigationItem.titleView = imageView
这篇关于Swift导航栏图像标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文