How to add a UIView above the current UITableViewController

后端 未结 20 805
旧时难觅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:34

    As UITableViewController is a subclass of UIViewController, you need to add your desired view to its superview.

    Swift:
    self.view.superview?.addSubview(viewTobeAdded)
    
    Objective C:
    [self.view.superview addSubview: viewTobeAdded];
    

提交回复
热议问题