ios - UISearchController - blank space hides status bar -


i'm using uisearchcontroller , working fine. leaving blank space on search bar (when focused) partially hides status bar. this espace

i tried setting self.edgesforextendedlayout = uirectedgenone self.navigationcontroller.extendedlayoutincludesopaquebars = yes space still there. tried setting self.definespresentationcontext = yes;but generated searchbar take status bar position like this.

i'm using uiviewcontroller embedded in uinavigationcontroller. setup im implementing now:

@interface directoryviewcontroller :  uiviewcontroller <uitableviewdatasource , uitableviewdelegate ,uisearchbardelegate, uisearchcontrollerdelegate, uisearchresultsupdating>  @property (strong, nonatomic) nsmutablearray *personsarray; @property (nonatomic, strong) uisearchcontroller *searchcontroller; @property (nonatomic, strong) nsmutablearray *searchresults;   @implementation directoryviewcontroller  - (void)viewdidload {     [super viewdidload]; uinavigationcontroller *searchresultscontroller = [[self storyboard] instantiateviewcontrollerwithidentifier:@"tablesearchresultsnavcontroller"];      // our instance of uisearchcontroller use searchresults     self.searchcontroller = [[uisearchcontroller alloc] initwithsearchresultscontroller:searchresultscontroller];      // searchcontroller's searchresultsupdater property contain our tableview.     self.searchcontroller.searchresultsupdater = self;     self.searchcontroller.delegate = self;     self.searchcontroller.searchbar.delegate = self;      //cancel button tint     _searchcontroller.searchbar.tintcolor = [uicolor whitecolor];     [self.searchcontroller.searchbar setbackgroundimage:[uiimage imagenamed:@"navbar"]                                                 forbarposition:0                                                     barmetrics:uibarmetricsdefault];      if ([self respondstoselector:@selector(edgesforextendedlayout)]) { /// ios 7 or above         self.edgesforextendedlayout = uirectedgenone;     }      self.navigationcontroller.extendedlayoutincludesopaquebars = yes;  } 

i appreciate help. thanks

i found solution in this answer.

changing tableinsets:

    self.directorytable.contentinset = uiedgeinsetsmake(-10, 0, 0, 0); 

when searchcontroller becamefirstresponder

and

    self.directorytable.contentinset = uiedgeinsetsmake(0, 0, 0, 0); 

when search bar action finished.


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -