Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 7 UISearchBar UISearchBarIconSearch

I am having an issue with iOS 7.

The code

[searchBar setImage:[UIImage imageNamed:@"icon_search"] forSearchBarIcon:UISearchBarIconSearch state:UIControlStateNormal];

brings different icon sizes on iOS 6 and iOS 7.

The image size is 29x29 and 58x58@2x and under iOS 6 it's displayed properly, but in iOS 7 it's twice or even more times smaller.

What could be the issue? Thanks!

like image 291
Dmitry Preobrazhenskiy Avatar asked Dec 09 '22 11:12

Dmitry Preobrazhenskiy


1 Answers

this seems to work for me:

UIImage* image = [UIImage imageNamed:@"icon_search"];
[[UIImageView appearanceWhenContainedIn:[UISearchBar class], nil] setBounds:CGRectMake(0, 0, image.size.width, image.size.height)];
like image 64
user2567372 Avatar answered Mar 16 '23 03:03

user2567372