Last active
May 25, 2018 13:06
-
-
Save oalansari82/663df38b06b4d244f667e45e314a3102 to your computer and use it in GitHub Desktop.
Replace NavigationController's title with a logo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Here you can set View width and height as per your requirement for displaying supportView position in navigationbar | |
let supportView = UIView(frame: CGRect(x: 0, y: 0, width: 120, height: 40)) | |
//supportView.backgroundColor = UIColor.red | |
let logo = UIImageView(image: UIImage(named: "logo")) //UIImage(named: "SelectAnAlbumTitleLettering") | |
// customize the origin as (45,5) but can pass them as your requirement. | |
logo.frame = CGRect(x: 0, y: -5, width: supportView.frame.size.width, height: supportView.frame.size.height) | |
supportView.addSubview(logo) | |
supportView.contentMode = .center | |
navigationItem.titleView = supportView |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment