Pushing a view controller:
func showChatLogForTrainer(trainer: Trainers) {
let chatLogVC = ChatLogVC(collectionViewLayout: UICollectionViewFlowLayout())
self.navigationController?.pushViewController(chatLogVC, animated: true)
}
But when running the app, it shows a white screen before showing the view controller. It didn't used to do this.. but I haven't touched how the view is shown so not sure why it's doing it now.
The viewDidLoad
in ChatLogVC
;
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController?.setNavigationBarHidden(false, animated: false)
self.collectionView?.backgroundColor = UIColor(red: 41/255, green: 38/255, blue: 45/255, alpha: 1);
self.collectionView?.register(ChatMessageCell.self, forCellWithReuseIdentifier: cellId)
self.collectionView?.alwaysBounceVertical = true
self.collectionView?.contentInset = UIEdgeInsets(top: 8, left: 0, bottom: 8, right: 0)
self.collectionView?.indicatorStyle = .white
self.collectionView?.keyboardDismissMode = .interactive
}
As it turns out it is a bug with the simulator. I have tried cleaning and rebuilding, along with restoring the simulator to default settings and restarting the simulator but the white screen bug persists.
But when running the app on my phone, pushing the view works as intended!
Xcode Version 8.2.1 (8C1002) - Simulator Version 10.0 (SimulatorApp-726.7)