【发布时间】:2014-12-28 17:33:38
【问题描述】:
我有麻烦了。我想在导航栏标题中使用图像,但出现错误,即“UIImage”不是“NSString”的子类型。代码下面,看一下。
class Dashboard: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.title = UIImage(named: "logo.png")
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
有人可以推荐吗?谢谢!
【问题讨论】:
-
您不能将 UIImage 类型的对象分配给 NSString。 navigationItem 的标题只能包含文本数据(NSString)。
标签: ios swift uinavigationbar