Skip to content

Instantly share code, notes, and snippets.

@pavel-sazonov
Created December 2, 2021 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pavel-sazonov/a686c8df96ab9966c6d8ef6f0f2cbf13 to your computer and use it in GitHub Desktop.
Save pavel-sazonov/a686c8df96ab9966c6d8ef6f0f2cbf13 to your computer and use it in GitHub Desktop.
add image to navbar center
private func addLogoToNavigationBar() {
let imageView = UIImageView()
imageView.contentMode = .scaleAspectFit
imageView.image = Images.Loyalty.lamodaClub.templatedImage
let contentView = UIView()
navigationItem.titleView = contentView
navigationItem.titleView?.addSubview(imageView)
imageView.snp.makeConstraints { make in
make.center.equalTo(contentView)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment