0

I am adding a button in searchbar on right side by this code

 [searchtextfield setRightView:customButton];
 [searchtextfield setRightViewMode:UITextFieldViewModeAlways];

It works upto iOS 6,but in iOS 7 i can not see it. Any idea how to accomplish it in iOS 7.

Mihir Mehta
  • 13,743
  • 3
  • 64
  • 88

1 Answers1

-1

If you have white background then may be its the issue that you can't see search bar, I faced same problem but managed to solve this by adding this code by setting table view background.

UIView *backgroundView = [[UIView alloc] initWithFrame:self.tableView.bounds];
backgroundView.backgroundColor = [UIColor clearColor];
self.tableView.backgroundView = backgroundView;

Hope it'll help. Thanks.

Aleem
  • 3,173
  • 5
  • 33
  • 71
  • I can see search bar, I can not see a button which i set as it's rightView. – Mihir Mehta Sep 30 '13 at 10:57
  • ahh, I think then u see this link"http://stackoverflow.com/questions/3052343/remove-clear-button-grey-x-to-the-right-of-uisearchbar-when-cancel-button-tapp", hope it'll help. if you like then raise my points. – Aleem Sep 30 '13 at 11:07