Navigation bar with UIImage for title
问题 I want to customize my app\'s look by using a logo image as the navigation bar\'s title, instead of plain text. When I use this code let logo = UIImage(named: \"logo.png\") self.navigationItem.titleView = logo; I get the error \"UIImage is not convertible to UIView\". How can I do this correctly? 回答1: Put it inside an UIImageView let logo = UIImage(named: "logo.png") let imageView = UIImageView(image:logo) self.navigationItem.titleView = imageView 回答2: I use this. It works in iOS 8 override