iOS   发布时间:2022-05-04  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了iphone – 部分内的部分 – UITableView –大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

我对tableView有一个问题. 我知道我们可以返回部分和行的数量. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 你能告诉我怎么能
我对tableView有一个问题.

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

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

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

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

我会回报什么

- (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.

大佬总结

以上是大佬教程为你收集整理的iphone – 部分内的部分 – UITableView –全部内容,希望文章能够帮你解决iphone – 部分内的部分 – UITableView –所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。