How to interact with UITableView in UIViewController?

前端 未结 2 1922
既然无缘
既然无缘 2020-12-10 07:46

I am addicted to use TableViewController in storyboard whose class directly inherits from UITableViewController and functions like:

- (UITableViewCell *)tabl         


        
2条回答
  •  南笙
    南笙 (楼主)
    2020-12-10 07:56

    Implement UITableViewDataSource and UITableViewDelegate protocols in your view controller .h file.

    Have an outlet for the UITableView.

    In viewDidLoad, set the tableView's datasource and delegate to self since the viewcontroller implements the protocol.

    Then, write the cellForRowAtIndexPath method. It will be getting called.

提交回复
热议问题