我刚刚进入没有更多故事板的程序化 vc,我正在关注 Brian Voong 的 YouTube 的 LetsBuildThatApp 以获得指导https://youtu.be/NJxb7EKXF3U?list=PL0dzCUj1L5JHDWIO3x4wePhD8G4d1Fa6N。
我按照所有指示进行操作,由于某种原因,当我启动我的应用程序时,我的屏幕上出现了这种浅灰色的雾霾,我不知道为什么?我可以隐约看到导航标题和蓝色背景,但它被褪色层覆盖。
第 1 步:我删除了我的情节提要文件并拆分了部署信息下的常规选项卡,我从主界面中删除了“主要”。
第 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 设为 Window 的根。我还更改了 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
我不知道为什么我的屏幕上出现这种浅灰色的雾霾
我在这里想念什么?