tags:

views:

177

answers:

0

The situation is when i assign a searchbar on tableview programmatically, my searchbar textfield editing is bugged. The searchBar cannot recall the "magnifier" effect and even the editing ability after few typing.

UISearchBar *mySearchBar = [[UISearchBar alloc]initWithFrame: CGRectMake(0.0f, 
                                                                           0.0f, 
                                                                           320.0f, 
                                                                           44.0f)];
self.tableView.tableHeaderView = mySearchBar;
[mySearchBar release];

I do the same code by using Interface Builder, it work perfectly. So, i think there is something missing on my code. I'm pretty newbie of it, and i don't have any clue. Thank you for any answers.

I also have tried these setting, but not helping

  [mySearchBar setClearsContextBeforeDrawing:YES];
  [mySearchBar setMultipleTouchEnabled:YES];
  [mySearchBar layoutSubviews];
  [mySearchBar setContentMode:UIViewContentModeRedraw];
  [mySearchBar setOpaque:NO];