In iOS7 the search icon and place holder text are always appearing in middle.I tried changing the text alignment of the text field in search bar to left but it didn't work. Is there any way to make the searchbar search icon appear left aligned in iOS7
I tried the following lines but it did not work:
UITextField *txfSearchField = [_searchBar valueForKey:@"_searchField"];
txfSearchField.textAlignment = NSTextAlignmentLeft;
[_searchArticle setImage:image forSearchBarIcon:UISearchBarIconSearch state:UIControlStateNormal];
UIimageView *im = [UIImageView alloc]init];
im.image = image;
txfSearchField.leftView =im;
See Question&Answers more detail:os