gpt4 book ai didi

objective-c - 同一 View 中的两个 UITableView

转载 作者:IT王子 更新时间:2023-10-29 08:18:13 26 4
gpt4 key购买 nike

我想知道是否允许使用 Multiple UItableView在同一个 View 中(我在 Apple's Human Interface Guidelines 中没有看到任何东西)如果没问题,如何加载不同的 DataSourceviewDidLoad对于每个 UITableView

最佳答案

您当然可以拥有多个 TableView 。您可能希望确保为每个对象都保留一个指针,然后在您的数据源方法中,您将执行如下操作:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
if(tableView == tableViewOne)
return 5;
else //if (tableView == tableViewTwo)
return 3;
}

这对于所有委托(delegate)/数据源方法都是一样的,这就是为什么它们会为您提供哪个 TableView 作为参数。

关于objective-c - 同一 View 中的两个 UITableView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5747889/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com