Reputation: 1588
I need to left align the magnifying glass icon in UISearchBar in iOS 7. I have tried many things posted here and there but so far I am unable to achieve this.
--Thanks in advance.
Upvotes: 1
Views: 1885
Reputation: 8349
You need to Customise the searcher instead of you already use.
UITextField *txfSearchField = [looksearchbar valueForKey:@"_searchField"];
[txfSearchField setBackgroundColor:[UIColor whiteColor]];
[txfSearchField setLeftViewMode:UITextFieldViewModeNever];
[txfSearchField setRightViewMode:UITextFieldViewModeNever];
[txfSearchField setBackground:[UIImage imageNamed:@"searchbar_bgImg.png"]];
[txfSearchField setBorderStyle:UITextBorderStyleNone];
//txfSearchField.layer.borderWidth = 8.0f;
//txfSearchField.layer.cornerRadius = 10.0f;
txfSearchField.layer.borderColor = [UIColor clearColor].CGColor;
txfSearchField.clearButtonMode=UITextFieldViewModeNever;
Try this.
Upvotes: 2