我只想知道如何使我的导航栏看起来像下图中左边的导航栏:
我的应用程序使用导航控制器,默认情况下导航栏看起来像图像右边的屏幕。我不喜欢它是如此小,并希望它更高,也能够改变颜色和字体的文字使用的标题。
我希望在如何做到这一点和在哪里放置代码的任何帮助。
谢谢
发布于 2015-06-04 15:44:01
有许多方法可以使您的导航栏定制:
//You can change the bar style
navigationController?.navigationBar.barStyle = UIBarStyle.Black
// You can change the background color
navigationController?.navigationBar.barTintColor = UIColor(red: 4 / 255, green: 47 / 255, blue: 66 / 255, alpha: 1)
// You can add a logo on it
let navBarImageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 30, height: 30))
navBarImageView.contentMode = .ScaleAspectFit
let navBarImage = UIImage(named: "myNavBarLogo.png")
navBarImageView.image = navBarImage
navigationItem.titleView = navBarImageView
//You can change the text color
navigationController?.navigationBar.tintColor = UIColor.yellowColor()
//You can change the font
if let font = UIFont(name: "AppleSDGothicNeo-Thin", size: 34) {
UINavigationBar.appearance().titleTextAttributes = [NSFontAttributeName: font]
}
您只需要使用这些属性就可以得到您想要的导航条。
我希望这对你有帮助!
发布于 2015-06-04 23:06:24
您可以在Interface中更改导航栏。
您可以通过更改条形色调来更改背景色。您还可以更改标题字体、颜色等,如下所示:
https://stackoverflow.com/questions/30655972
复制