How to add a toolbar to the bottom of a UITableViewController in Storyboards?

前端 未结 6 1947
温柔的废话
温柔的废话 2020-12-04 14:21

In my UITableView that I have setup using Storyboards, I need to be able to add a tool bar that sticks to the bottom of the view, it should not scroll.

6条回答
  •  天命终不由人
    2020-12-04 15:17

    if you want show toolbar in one view controller which placed in some navigation controller.

    1. select view controller in storyboard
    2. in utilities, show "attribute inspector". select "bottom bar" style.
    3. add bar button item
    4. add code in view controller, to show and hide toolbar:

    code:

    - (void)viewWillAppear:(BOOL)animated
    {
        [self.navigationController setToolbarHidden:NO animated:YES];
    }
    
    - (void)viewWillDisappear:(BOOL)animated
    {
        [self.navigationController setToolbarHidden:YES animated:YES];
    }
    

提交回复
热议问题