Note that there are some explanatory texts on larger screens.

plurals
  1. POSearchDisplayController SearchBar overlapping navigation bar and resizing itself IOS7
    primarykey
    data
    text
    <p>My app has a tableview controller that is presented as a form sheet. </p> <p>On top portion of tableviewcontoller there is a UView and inside of that UIView there is a navigation bar and a searchbar. </p> <p>Everything works fine older version of IOS but in IOS7 when user taps searchbar everything is messes up. </p> <p>Normal: <img src="https://i.stack.imgur.com/tf94R.png" alt="enter image description here"></p> <p>When User starts to type: <img src="https://i.stack.imgur.com/j1kho.png" alt="enter image description here"></p> <p>After seach ends: <img src="https://i.stack.imgur.com/cBGQW.png" alt="enter image description here"></p> <p>in.h</p> <pre><code>UITableViewController&lt;UITextFieldDelegate,UISearchDisplayDelegate,UISearchBarDelegate&gt; @property (nonatomic,weak) IBOutlet UINavigationBar *topBar; </code></pre> <p>Tried few things but code doesnt seem to be changing anything, when put a breakpoint it enters to delegate methods though</p> <p>in.m</p> <pre><code>//-(void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller { // if ([[[UIDevice currentDevice] systemVersion] floatValue] &gt;= 7.0) { // CGRect statusBarFrame = self.topBar.frame; // [UIView animateWithDuration:0.25 animations:^{ // for (UIView *subview in self.tableView.subviews) // subview.transform = CGAffineTransformMakeTranslation(0, statusBarFrame.size.height+50); // }]; // } //} // //-(void)searchDisplayControllerWillEndSearch:(UISearchDisplayController *)controller { // if ([[[UIDevice currentDevice] systemVersion] floatValue] &gt;= 7.0) { // [UIView animateWithDuration:0.25 animations:^{ // for (UIView *subview in self.tableView.subviews) // subview.transform = CGAffineTransformIdentity; // }]; // } //} - (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller { if ([[[UIDevice currentDevice] systemVersion] floatValue] &gt;= 7.0) { CGRect frame = self.searchDisplayController.searchBar.frame; frame.origin.y += self.topBar.frame.size.height; self.searchDisplayController.searchBar.frame = frame; } } - (void)searchDisplayControllerWillEndSearch:(UISearchDisplayController *)controller { if ([[[UIDevice currentDevice] systemVersion] floatValue] &gt;= 7.0) { CGRect statusBarFrame = self.topBar.frame; CGRect frame = self.searchDisplayController.searchBar.frame; frame.origin.y -= statusBarFrame.size.height; self.searchDisplayController.searchBar.frame= frame; } } #Additional Info - (void)viewDidLoad { [super viewDidLoad]; if ([[[UIDevice currentDevice] systemVersion] floatValue] &gt;= 7) { //self.searchDisplayController.searchBar.searchBarStyle= UISearchBarStyleProminent; self.edgesForExtendedLayout = UIRectEdgeNone; //self.edgesForExtendedLayout = UIRectEdgeLeft | UIRectEdgeBottom | UIRectEdgeRight; } } </code></pre> <p><img src="https://i.stack.imgur.com/5ClKn.png" alt="enter image description here"></p> <p>According to break points frame position and sizes are correct but they dont change <code>self.searchDisplayController.searchBar.frame at all</code> </p> <p>I have also tried</p> <pre><code>-(void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller { if ([[[UIDevice currentDevice] systemVersion] floatValue] &gt;= 7.0) { [self.topBar setHidden:YES]; } } -(void)searchDisplayControllerWillEndSearch:(UISearchDisplayController *)controller { if ([[[UIDevice currentDevice] systemVersion] floatValue] &gt;= 7.0) { [self.searchDisplayController.searchBar removeFromSuperview]; CGRect frame = self.searchDisplayController.searchBar.frame; frame.origin.y += self.topBar.frame.size.height; self.searchDisplayController.searchBar.frame = frame; [self.topView addSubview:self.searchDisplayController.searchBar]; [self.topView bringSubviewToFront:self.topBar]; [self.topBar setHidden:NO]; } } </code></pre> <p>How can I solve this issue ? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload