I belive it's possible.
If you want some simple user interactions like drag down, then you need to use UIScrollView
and implement its delegate. After that, you can use some of these methods
– scrollViewWillEndDragging:withVelocity:targetContentOffset:
– scrollViewDidEndDragging:willDecelerate:
Then just show/hide the UINavigationBar
afterward
[self.navigationController setNavigationBarHidden:YES/NO animated:YES];
If the logic above does not work. You can fake the UINavigationBar
with an UIView
. It's easy to show and hide it with these delegate.
//Edit: if you don't want to use UIScrollView
, you can use UIPanGestureRecognizer
and check if the gesture is a drag down/up or not. However, I think using UIScrollView
will be much easier.
//Update:
You can still use UIScrollView
and UIWebView
. Like this
-(void)viewDidLoad
{
//init an UIScrollView and UIWebView
[self.view addSubview:theScrollView];
[theScrollView addSubview:theWebView];
//back button
UIButton *back = [[UIButton alloc] init];
//custom button: set its frame, title, image ...
//set action for button
[back addTarget:self action:@selector(backAction:) forEvent:UIControlEventTouchUpInside];
//add to view
[theWebView addSubView: back]; //or [self.view addSubView:back]; --both will work just fine
}
-(void)backAction:(UIButton *)sender
{
//if you use navigation push, use this
[self.navigationController popViewControllerAnimated:YES];
//if you use navigation modal, add this line of code to its previous view controller
[self.navigationController dismissViewControllerAnimated: YES completion: nil];
}
Done ! :)