UITableView cellforrowatindexpath not called

后端 未结 12 847
梦谈多话
梦谈多话 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 07:59

    If the mutable array or the array you are using to populate the contents of the cell is set as a property in your header file. then make sure you always use

    self.yourArray = [[NSMutableArray alloc] init];
    [self.yourArray addObject:@"Object1"];
    

    and then to get the count in numberOfRowsInSection as well you need to access it as:

    return [self.yourArray count];
    

    This is pretty much like the this pointer you use to refer to your instance variables. And yes of course you also need to keep in mind if you have set the dataSource and delegate of the UITableView to the file's owner. Also that you have included the UITableViewDelegate and UITableViewDataSource in your header file of the viewController.

    I hope it helps you. Best Of Luck. Happy Coding! Cheers!!

提交回复
热议问题