gpt4 book ai didi

ios - 如何在表格 View 中隐藏行。隐藏索引后应该不会改变 iOS

转载 作者:行者123 更新时间:2023-11-29 02:15:23 24 4
gpt4 key购买 nike

我有这样的数组:

array = (@"",@"Cricket",@"Planet",@"Football",@"",@"",@"HelloWorld").

我在表格 View 中显示。它还显示所有具有空对象的对象。我想隐藏或隐藏空行。

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath: (NSIndexPath *)indexPath                                       
{
UITableViewCell* cell = [super tableView:tableView cellForRowAtIndexPath:indexPath];
if([array objectisIdenticalto:@""])
{
return 0;
}else
{
return 30;
}

我需要与值所在位置相同的索引。我需要相同的索引路径并且不在 TableView 中显示空值。我的英语不好,请合作并帮助解决问题。

最佳答案

您正在检查您的数组是否等于 @""但您想要检查数组中该索引处的对象。

尝试:

...
if ([array[indexPath.row] isEqualToString:@""]) {
return 0;
}
...

关于ios - 如何在表格 View 中隐藏行。隐藏索引后应该不会改变 iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28813622/

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