[英]iOS 11 navigationBar size with SearchBar
像這樣初始化搜索欄
let searchBar = UISearchBar(frame: CGRect(x: 20, y: 0, width: UIScreen.main.bounds.width-40, height: 40))
//Change x,y,width,height according to your need
希望這個能對您有所幫助
創建一個自定義標題視圖(UIView)並將其添加到導航欄titleview中。 在自定義標題視圖中,應該使用UILayoutFittingExpandedSize覆蓋internalContentSize方法。
就像目標C:
- (CGSize)intrinsicContentSize {
return UILayoutFittingExpandedSize;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.