我刚开始接触程序化的风投,没有更多的故事板,我正在关注YouTube的LetsBuildThatApp,作者是布赖恩·沃恩,作者是guidance https://youtu.be/NJxb7EKXF3U?list=PL0dzCUj1L5JHDWIO3x4wePhD8G4d1Fa6N。
我遵循了所有的指示,但由于某种原因,当我启动我的应用程序时,我的屏幕上出现了这种浅灰色的雾霾,我不知道为什么?我可以隐约看到导航标题和蓝色背景,但它被一个褪色的图层覆盖。
步骤1:我删除了我的故事板文件,并在部署信息下的常规选项卡下删除了主界面中的" Main“。
步骤2:我将ProjectNavigator文件更改为FeedController,然后相应地更改该文件
import UIKit
class FeedController: UICollectionViewController {
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.title = "Facebook Feed"
collectionView?.backgroundColor = UIColor.white
}
}步骤3:在AppDelegate中,我添加了一个NavVC,并将FeedVC设为其根,并将NavVC设为窗口的根。我还更改了NavBar和StatusBar的颜色
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
window = UIWindow(frame: UIScreen.main.bounds)
window?.makeKeyAndVisible()
let feedController = FeedController(collectionViewLayout: UICollectionViewFlowLayout())
let navVC = UINavigationController(rootViewController: feedController)
window?.rootViewController = navVC
UINavigationBar.appearance().tintColor = UIColor.blue
UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName: UIColor.white]
application.statusBarStyle = .lightContent
return true
}步骤4:在info.plist中,我将View controller-based status bar appearance设置为NO
我搞不懂为什么我的屏幕上有这种浅灰色的雾气

这里我漏掉了什么?
发布于 2017-06-29 10:14:23
看起来您配置的是tintColor而不是barTintColor。tintColor更改导航按钮的颜色,而barTintColor调整导航栏的背景色。您可以观看此视频,了解有关自定义导航栏外观的更多详细信息。
https://stackoverflow.com/questions/44788691
复制相似问题