本文主要是介绍Swift UINavigationBar 设置,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
UINavigationBar.appearance().isTranslucent = true //界面顶部透明
UINavigationBar.appearance().tintColor = UIColor.white//字体颜色
UINavigationBar.appearance().shadowImage = UIImage.lkCreateImage(with:UIColor.clear)//阴影颜色
UINavigationBar.appearance().setBackgroundImage(UIImage.lkCreateImage(with:UIColor.clear), for:UIBarMetrics.default)//背景颜色
UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName:UIColor.white,NSFontAttributeName:UIFont.boldSystemFont(ofSize:18)] //title 字体大小
UIBarButtonItem.appearance().setBackButtonBackgroundImage(UIImage.init(lkNamed:"Titlebackbg.png").resizableImage(withCapInsets:UIEdgeInsetsMake(0,20, 0,0)), for: UIControlState.normal, barMetrics:UIBarMetrics.default)//返回图片设置
UIBarButtonItem.appearance().setBackButtonTitlePositionAdjustment(UIOffsetMake(0,-60), for: UIBarMetrics.default)//去掉返回图片后面的文字
这篇关于Swift UINavigationBar 设置的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!