How to add a UIView above the current UITableViewController

后端 未结 20 841
旧时难觅i
旧时难觅i 2020-11-27 11:57

I have difficulty adding a subview (UIView) from within the viewDidLoad method of a UITableViewController

This works:

[self.view addSubview:self.prog         


        
20条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-27 12:41

    There may be reasons not to do this, but this works for me so far. If you use an ap

    Inside viewDidLayoutSubviews you can run this, but make sure to only run it once obviously

    self.searchTableView = [[UITableView alloc] initWithFrame:self.tableView.frame style:UITableViewStylePlain];
    self.searchTableView.backgroundColor = [UIColor purpleColor];
    [self.view.superview addSubview:self.searchTableView];
    

提交回复
热议问题