views:

89

answers:

2

I am creating a UINavigationBar which works fine. But, it scrolls with my UITableView, which I don't want. How can I anchor the navbar at the bottom of the screen, so that it does NOT scroll?

    bottomNav = [[UINavigationBar alloc] initWithFrame:CGRectMake(0.0, self.view.frame.size.height, self.view.frame.size.width, 44.0)];
    bottomNav.barStyle = UIBarStyleBlackOpaque;
    [self.view addSubview:bottomNav];
+2  A: 

It sounds like your adding it to the tableview instead of view that contains the tableview. If self is a tableview controller that is definitely your problem.

TechZen
A: 

Yes, TechZen you were right. I needed to add it to my parent view controller:

bottomNav = [[UINavigationBar alloc] initWithFrame:CGRectMake(0.0, self.view.frame.size.height - 20, self.view.frame.size.width, 44.0)];
bottomNav.barStyle = UIBarStyleBlackOpaque;
[self.parentViewController.view addSubview:bottomNav];
Nic Hubbard
You should accept his answer if it's correct
Ed Marty
I will, but it says I can't for 2 days.
Nic Hubbard