Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ranguvar

macrumors 6502
Original poster
Sep 18, 2009
318
2
Hi,

in Interface Builder, if I drop a UISearchBar into my view, set its style to black and enable the cancel button, here's what I get:

11al638.png


The color of the cancel button is obviously wrong. Only with the following code ...

Code:
// Assume a UISearchBar searchBar.
NSArray *subviews = [searchBar subviews];

// The index depends on how you configure the searchBar.
UIButton *cancelButton = [subviews objectAtIndex:3];

// Set the style to "normal" style.
[cancelButton setStyle:0];

... I can make the cancel button look how it should:

kc16op.png



Is this a bug? Has somebody else encountered this problem? How can I solve the problem without the hack I'm currently using?

Thanks!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.