继承UISearchBar.   重载setShowCancelButton.

[super xxx]; ...

for (UIView *subview in self.subview) {

if (subview isKindeOfClass:UIButton.class]) {

cancelButton * = (UIButton*) subview;

break;

}

05-11 19:28