首页 > 学院 > 开发设计 > 正文

为什么cellForRowAtIndexPath方法不调用?

2019-11-06 09:55:18
字体:
来源:转载
供稿:网友
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;

没有被调用的原因可能是数据源中没有数据!

注意这几个相关方法的调用顺序是: 1、先调用numberOfSectionsInTableView

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;

当有数据时才会往下进行,才会调用方法:tableView:cellForRowAtIndexPath;

2、当numberOfSectionsInTableView不为0时说明有数据,这时才会获取每个section中的numberOfRows

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表