0

I am trying to hide the navigational bars according to the cursor positions.so, that I can use the full screen of the iPhone. But I donno how to start it.

Similar (less confusing :) ) question: Show/hide UIToolbar, "match finger movement", precisely as in for example iOS7 Safari

Cœur
  • 37,241
  • 25
  • 195
  • 267
iphoneStruggler
  • 21
  • 1
  • 2
  • 4

2 Answers2

1

Use the below code if you want to hide and unhide the navigation bar on double tap on any part of the view

In your .h file:

IBOutlet UINavigationController *navigationController;

Connect the IBOutlet in your XIB.

in your .m file:

  -(void)viewDidLoad {

  [super viewDidLoad];

  [navigationController setNavigationBarHidden:YES];



 }

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch = [touches anyObject];

  if (touch.tapCount == 2) {

       [navigationController setNavigationBarHidden:NO];
       [NSTimer scheduledTimerWithTimeInterval:(1.0) target:self   selector:@selector(hideBar) userInfo:nil repeats:NO];


      }

  }

-(void)hidebar{

[navigationController setNavigationBarHidden:YES];



}

Do the modifications as per your requirement.

Happy coding!

epetousis
  • 455
  • 1
  • 4
  • 21
Suresh Varma
  • 9,750
  • 1
  • 60
  • 91
0

There is no cursor on iPhone, but do you mean that you want to do something like safari - hide the address bar when scroll down more than one screen page?

Assume that you are using UITableView, I have a solution that: 1. we are already know height of each table row -> cell.frame.size.heigh 2. and we already know height of screen -> view.bounds.size.height 3. UITableView call cellForRowAtIndexPath every time it generate a cell So you can easily know how many cells are there in you table, row index and total height of them, whenever you see a row index which belong to next screen page, you should hide navigation bar with an animation. otherwise, if all row index are belong to 1st screen -> show navigation bar with animation.

Son Nguyen
  • 3,481
  • 4
  • 33
  • 47