1
所以我想建立一個自定義圖像使用下面的代碼我UISearchField圖像:的UISearchBar setSearchFieldBackgroundImage問題
UISearchBar * searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 300, 44)];
searchBar.placeholder = @"Search for a tag";
searchBar.delegate = self;
[searchBar setSearchFieldBackgroundImage:[UIImage imageNamed:@"search-bg.png"] forState:UIControlStateNormal];
UITextField *searchField = [searchBar valueForKey:@"_searchField"];
searchField.textColor = [UIColor whiteColor];
但是也有一些是錯誤的放大鏡,我有。結果如下:
如果你看到密切放大鏡實際上是透明的,而不是白色。在圖像中,我將它設置爲白色。任何想法,爲什麼這可能會發生?