首页 > 代码库 > 隐藏UISearchBar中的删除按钮

隐藏UISearchBar中的删除按钮

<style>p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo } p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px } span.s1 { } span.s2 { color: #bb2ca2 } span.s3 { color: #703daa } span.s4 { color: #4f8187 } span.s5 { color: #3d1d81 }</style> <style>p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #703daa } span.s1 { }</style>

 

UISearchBar *searchBar;

 

for (UIView *subview in [searchBar.subviews firstObject].subviews{

  if ([subview isKindOfClass:[UITextField class]]) {

    UITextField *searchField = (UITextField *)subview;

    searchField.clearButtonMode = UITextFieldViewModeNever;

    break;

  }

}

隐藏UISearchBar中的删除按钮