How to subclass UITableViewController in Swift

后端 未结 9 1835
栀梦
栀梦 2020-12-23 11:42

I want to subclass UITableViewController and be able to instantiate it by calling a default initializer with no arguments.

class TestViewController: UITableV         


        
9条回答
  •  臣服心动
    2020-12-23 12:01

    matt's answer is the most complete, but if you do want to use a tableViewController in the .plain style (say for legacy reasons). Then all you need to do is call

    super.init(nibName: nil, bundle: nil)

    instead of

    super.init(style: UITableViewStyle.Plain) or self.init(style: UITableViewStyle.Plain)

提交回复
热议问题