UITableView delegate and dataSource methods not getting called

后端 未结 8 1383
野性不改
野性不改 2021-02-13 14:23

I have a UIView which contains a UITableView. The tableview\'s delegate is set to my UIView, but it never calls the delegate methods:

-(id)init {
    self = [sup         


        
8条回答
  •  死守一世寂寞
    2021-02-13 15:13

    Can you please write the code that you have written on your cellForRowAtIndexPath: method? Because i can't find anything wrong with your code.

    Are you calling your UIView from some other ViewController? If yes, how?

    I have done something like this once. I declared a method in the UIView like this :

    - (void)setUpTableView{
        self.tableview.delegate=self;
        self.tableview.dataSource=self;
    }
    

    And then i called the setUpTableView from the view controller i added this view to, like this :

    [self.yourView setUpTableView]; 
    

    This might help. Thanks.

提交回复
热议问题