UITableView cellforrowatindexpath not called

后端 未结 12 911
梦谈多话
梦谈多话 2021-01-05 07:24

I am pretty new to Iphone development . so please bear me if I ask some very simple questions.

In my application I have multiple views(i.e. .xib files). On clicking

12条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-05 08:09

    Did you make sure to set the table view as the delegate?

    If you have a UITableViewController, you this need in viewDidLoad:

    [self.tableView setDelegate:self];
    

    If you have another type of view controller, just make the UITableView an IBOutlet, make the connections to the file owner for tableViewDelegate and tableViewDataSource then do this in viewDidLoad:

    [self.myTableProperty setDelegate:self];
    

    Also make sure to conform to the UITableViewDelegate and UITableViewDataSource protocols in your .h file if the View Controller is not a UITableViewController

    Cheers

提交回复
热议问题