iOS 11とswift 4(Xcode 9)をアップグレードした後、UIの問題がたくさんありました。 :(
ほとんど解けない問題は、ナビゲーションの問題である。
私はUICollectionViewコントローラー。
ナビゲーションバーの高さが正しく表示されませんし、私はコードを書くしかし。
swift 4、iOS 11のUICollectionViewにナビゲーションバーを追加
私は、ナビゲーションバーの高さを設定するにはナビゲーションバーを入れて」 100" 。私は(のviewDidLoadでこのコードを書く)。
if #available(iOS 11.0, *) {
print("IOS 11 Screen")
UINavigationBar.appearance().largeTitleTextAttributes = [
NSForegroundColorAttributeName: UIColor.white,
]
navigationItem.largeTitleDisplayMode = .never
let height: CGFloat = 100 //whatever height you want
let bounds = self.navigationController!.navigationBar.bounds
self.navigationController?.navigationBar.frame = CGRect(x: 0, y: 0, width: bounds.width, height: bounds.height + height)
} else {
print("lower than IOS 11 Screen")
// Fallback on earlier versions
}
collectionview?.frame = CGRect(x: 0, y: 10, width: UIScreen.main.bounds.width, height: (UIScreen.main.bounds.height + 20)) <br>
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let height: CGFloat = 100 //whatever height you want
let bounds = self.navigationController!.navigationBar.bounds
self.navigationController?.navigationBar.frame = CGRect(x: 0, y: 0, width: bounds.width, height: bounds.height + height)
}
override func viewWillAppear(_ animated: Bool) {
let height: CGFloat = 100 //whatever height you want
let bounds = self.navigationController!.navigationBar.bounds
self.navigationController?.navigationBar.frame = CGRect(x: 0, y: 0, width: bounds.width, height: bounds.height + height)
}
はしかし、私はこのコードを試してみました。何が私のために動作しません。
私はまた、ソースコードビューでストーリーボードを開こうとしたと私は、ナビゲーションバーの高さを編集します。しかし、それはまた動作しません。
誰も私を助けることができますか?私はこの2日間でこの問題を解決しようとしています。
は、私はあなたがナビゲーションバーの高さを調整することができるとは思いません。代わりに、カスタムナビゲーションバーを作成し、システムによって与えられたナビゲーションバーを隠すことができます。 – antonio081014