[英]iOS 11 UISearchBar in navigation bar
UISearchBar在iOS 11中的行為與在iOS 10及以下版本中的行為不同。
我使用以下代碼以某種方式“固定”尺寸:
if #available(iOS 11.0, *) {
searchBar.heightAnchor.constraint(equalToConstant: 44).isActive = true
}
但是我無法修復動畫。 除了在推送時手動設置搜索欄動畫之外,還有其他想法嗎?
UIView.animate(withDuration: 0.3, animations: { [weak self] in
guard let strongSelf = self else { return }
strongSelf.searchBar.alpha = 0.0
})
在此處觀看有關動畫效果損壞的視頻。
只需用UIView包裝它,動畫就會回來。
在UIPercentDrivenInteractiveTransition中查找答案。 在UINavigationController過渡期間,用於更新Persentage值的UIViews。
換句話說,取決於已打開下一個視圖控制器或向后移動視圖的UINavigationController有多少外觀。
此值將幫助您更新搜索欄(字母,寬度等)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.