Add buttons under a tableview

前端 未结 3 1135
感动是毒
感动是毒 2021-02-11 02:27

I\'m trying to create a view programmatically. The result that i want to have is a scroll view with a tableview inside. And under this table view i want to add some buttons

3条回答
  •  情深已故
    2021-02-11 03:10

    If you have the UITableView inside a UINavigationController you can set toolbar items at the bottom on your UITableViewController / UIViewController.

    UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:nil action:nil];
    self.toolbarItems = @[barButton];
    

    Please remember to show the Toolbar as well like this:

    self.navigationController.toolbarHidden = NO;
    
    //or animated
    [self.navigationController setToolbarHidden:NO animated:YES];
    

    That is probably cleaner than hacking a view below your table.

提交回复
热议问题