Adding a toolbar to the navigation controller

Sup fellas, so I have a navigation controller with a table view to which I am trying to add a toolbar, however, the way I implemented it causes the last row in the table to hide behind the toolbar. I will try to illustrate the images:

The table view scrolls from the bottom without a toolbar:

alt text

The table view scrolls to the bottom of the toolbar (note how the last line of the "Provider" is hidden behind the toolbar):

alt text

I followed this , and this is what I did for my implementation:

alt text

As you can see, I have a β€œView” instead of a β€œWindow” for work. Here is the code to display the toolbar:

- (void)viewDidLoad {
    [super viewDidLoad];
 [self.view addSubview:self.navigationController.view];
 [self.view addSubview:toolbar];
 [self.navigationController.view setFrame:self.view.frame];
}

, , . . ? !

+3
2

, . IB.

Check "Shows Toolbar" box in IB

+4

.

UINavigationController 44 .

:

- (void)viewDidLoad {
   [super viewDidLoad];
   [self.view addSubview:self.navigationController.view];
   [self.navigationController.view setFrame:CGRectMake(self.view.frame.x, self.view.frame.y, self.view.frame.width, self.view.frame.height - 44.0f)];
   [self.view addSubview:toolbar];
}
+4

Source: https://habr.com/ru/post/1780809/


All Articles