加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

iphone – 部分内的部分 – UITableView –

发布时间:2020-12-14 19:47:22 所属栏目:百科 来源:网络整理
导读:我对tableView有一个问题. 我知道我们可以返回部分和行的数量. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 你能告诉我怎么能有这样的东
我对tableView有一个问题.

我知道我们可以返回部分和行的数量.

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

你能告诉我怎么能有这样的东西:

  • A section within a section (and another section,if possible) – – And
    then configure the rows there ?

我会回报什么

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

解决方法

您必须在cellForRowAtIndexPath中创建自己的实现,其中返回的行实际上由多行和标题标签组成.或者更好的是将每隔一行设为“标题行”并检查cellForRowAtIndexPath,无论您是在“标题行”还是正常行;这样的事情:

if (indexPath.row == 0) {
     // return header row
} else {
     // return normal row
}

当然,在numberOfRowsInSection中,你必须为带有标题的部分返回正常的行数1.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读