如何删除UISearchBar在UITableViewController中的底线?
快速解决方案也可以应用。

这是我的VC代码:
NavigationController.NavigationBar.PrefersLargeTitles = true;
NavigationController.NavigationItem.LargeTitleDisplayMode = UINavigationItemLargeTitleDisplayMode.Automatic;
NavigationItem.HidesSearchBarWhenScrolling = false;
var searchController = new UISearchController(searchResultsController: null);
NavigationItem.SearchController = searchController;
NavigationItem.SearchController.DefinesPresentationContext = true;
NavigationItem.SearchController.DimsBackgroundDuringPresentation = false;对于AppDeletage.cs
UINavigationBar.Appearance.Translucent = false;
UINavigationBar.Appearance.ShadowImage = new UIImage();我尝试了我在互联网上找到的几乎所有的解决方案。
不要使用下一个解决方案:
UISearchBar.Appearance.BackgroundImage = null;
UISearchBar.Appearance.BackgroundColor= UIColor.Clear;NavigationItem.SearchController.Layer.BorderWidth = 0
NavigationItem.SearchController.Layer.BorderColor = UIColor.White.CGColorNavigationItem.SearchController.SearchBar.ClipsToBounds = true;发布于 2019-01-09 06:18:08
以下是解决办法:
public override void ViewWillLayoutSubviews()
{
base.ViewWillLayoutSubviews();
((UIImageView) NavigationItem.SearchController.SearchBar.Superview?.Subviews.First().Subviews.First()).Bounds = CGRect.Null;
}https://stackoverflow.com/questions/54034187
复制相似问题