objective c - Making the UINavigationBar Disappear and Appear on a touch, mimicking safari on iOS -
i have uipageviewcontroller
called uitableviewcontroller
, shows series of images user.
the images contain lot of information , while doesn't make sense have uinavigationbar
entire time, because it's used share image, or go back, there way mimic safari on ios, uinavigationbar
@ top disappears , reappears on touch?
i have not tried because don't have first clue on start this. there third-party open source framework, or easy way animate this? perhaps in viewdidload, have timer on uinavigationbar
, show @ start , disappear after 2 seconds, etc, reappear on touch?
any guidance on appreciated.
ios 8 provide default feature
self.navigationcontroller.hidesbarsontap = true;
[edited] add tap gesture in viewdidload
uitapgesturerecognizer *taprecognizer = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(taphandle:)]; [self.view addgesturerecognizer:taprecognizer];
add following method viewcontroller
- (void)taphandle:(uitapgesturerecognizer*)sender { dispatch_after(dispatch_time(dispatch_time_now, 2 * nsec_per_sec), dispatch_get_main_queue(), ^{ if (self.navigationcontroller.navigationbarhidden == no) { [[self navigationcontroller] setnavigationbarhidden:yes animated:yes]; } else{ [[self navigationcontroller] setnavigationbarhidden:no animated:yes]; } }); }
Comments
Post a Comment