i've uiview in i've placed uisearchbar , uibutton below screenshots explains problem: 
^this how appears when first run app 
^this how gets when want enter text 
^finally size gets after end search
the important point here i'm not using uinavigationbar red uiview. i've haven't coded it's ui, placed in .xib , set via autoresizing. wrote uisearchbar [_searchbartop setbackgroundimage:[uiimage new]]; background image vanished.
i've tried self.searchbartop.clipstobounds = yes; , this
- (void)searchdisplaycontrollerdidendsearch:(uisearchdisplaycontroller *)controller { self.searchdisplaycontroller.searchbar.translatesautoresizingmaskintoconstraints = yes; [self.searchdisplaycontroller setactive:no animated:yes]; } i'm using searchdisplaycontroller , want use that it's still same. suggestions?
if you're using simple uisearchbar in uiview, don't need use uisearchcontroller per sè. can use uisearchbar , it's respective delegates instead.
as resizing issue, think have autoresizing @ flexible width, whereas need static width, static sides. apply both uiview , embedded uisearchbar. should fix issue. let me know if problem persists.
if autoresizing doesn't work, can force this:
-(void)searchbartextdidendediting:(uisearchbar *)searchbar { dispatch_after(dispatch_time(dispatch_time_now, (int64_t)(0.01 * nsec_per_sec)), dispatch_get_main_queue(), ^{ cgrect frame = self.searchbartop.frame; frame.origin.x = 33; frame.size.width = self.view.frame.size.width - 41; [uiview animatewithduration:0.5 animations:^{ self.searchbartop.frame = frame; }]; }); }
Comments
Post a Comment