UISearchBar 背景图像在边缘显示黑色
UISearchBar background image showing black color on edges
我正在尝试在 UISearchBar 上应用背景图片。它已成功应用,但黑色显示在搜索栏的四个边缘。
这是我使用的代码:
[_dashboardSearch setSearchFieldBackgroundImage:[UIImage imageNamed:@"search-bar.png"] forState:UIControlStateNormal];
[_dashboardSearch setBackgroundColor:[UIColor clearColor]];
[_dashboardSearch setImage:[UIImage imageNamed:@"search_icon.png"] forSearchBarIcon:UISearchBarIconSearch state:UIControlStateNormal];
已解决。我在 UISearchBar 中将黑色设置为 UITexfield 背景。以下代码行被误写:
[(UITextField *)subSubView setBackgroundColor:[UIColor blackColor]];
我正在尝试在 UISearchBar 上应用背景图片。它已成功应用,但黑色显示在搜索栏的四个边缘。
这是我使用的代码:
[_dashboardSearch setSearchFieldBackgroundImage:[UIImage imageNamed:@"search-bar.png"] forState:UIControlStateNormal];
[_dashboardSearch setBackgroundColor:[UIColor clearColor]];
[_dashboardSearch setImage:[UIImage imageNamed:@"search_icon.png"] forSearchBarIcon:UISearchBarIconSearch state:UIControlStateNormal];
已解决。我在 UISearchBar 中将黑色设置为 UITexfield 背景。以下代码行被误写:
[(UITextField *)subSubView setBackgroundColor:[UIColor blackColor]];