美文网首页
iOS开发UINavigationController

iOS开发UINavigationController

作者: lczalh | 来源:发表于2018-09-25 17:30 被阅读17次

1.获取当前控制器

    nav.topViewController

2.设置导航栏背景透明

    self.navigationBar.setBackgroundImage(UIImage(),for: .default)
    self.navigationBar.shadowImage = UIImage()

3.设置导航条 标题颜色、大小

     self.navigationBar.titleTextAttributes = [NSAttributedStringKey.font: font,NSAttributedStringKey.foregroundColor: titleColor] as [NSAttributedStringKey : Any]

4.设置导航栏背景图片

    let bgImage = UIImage(named: imageName!)?.resizableImage(withCapInsets: UIEdgeInsetsMake(0, 0, 0, 0), resizingMode: .stretch)
    self.navigationBar.setBackgroundImage(bgImage, for: .default)

相关文章

网友评论

      本文标题:iOS开发UINavigationController

      本文链接:https://www.haomeiwen.com/subject/djvloftx.html