Changing the size of the UISearchBar TextField ?

Posted by Padraig on Stack Overflow See other posts from Stack Overflow or by Padraig
Published on 2009-02-17T13:38:31Z Indexed on 2010/05/20 2:50 UTC
Read the original article Hit count: 257

Filed under:
|
|
|

I have a UITableView with an Index on the side; I want to add a UISearchBar to it, but the index overlaps with the "x" to clear the search. I've noticed in the Contacts application, the textfield within the UISearchBar is resized to accommodate this, but I can't work out how to do this in my own app.

I have tried the following in my viewDidLoad, but it does not seem to work.

UITextField * textField = (UITextField *)[[self.search subviews] objectAtIndex:0];
CGRect r = textField.frame;

[textField setFrame:CGRectMake(r.origin.x, r.origin.y, r.size.height, r.size.width-30)];

Any ideas?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk