【发布时间】:2013-12-05 08:51:05
【问题描述】:
我的 UITtableView 在 IOS 7 上表现异常,在 IOS 6 上运行良好。当使用搜索栏过滤单元格时,它看起来好像有一个单元格重叠在彼此之上。我不知道如何用语言表达,但这里有图片
在 iOS 7 上
在 iOS 6 上
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (tableView == self.tableView)
{
return [self.airportArray count];
}
else
return [filterArray count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
cell.backgroundColor=[UIColor whiteColor];
}
NSMutableDictionary *cDict;
if (tableView == self.tableView)
{
cDict = [self.airportArray objectAtIndex:indexPath.row];
}
else
{
cDict = [filterArray objectAtIndex:indexPath.row];
}
cell.textLabel.text = [cDict objectForKey:@"code4"];
return cell;
}
#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSMutableDictionary *cDict;
if (tableView == self.tableView) {
cDict = [self.airportArray objectAtIndex:indexPath.row];
}
else {
cDict = [filterArray objectAtIndex:indexPath.row];
}
if (_currentTextField == _viewController.diversion1TextField) {
[_viewController setChooseAirport1:cDict];
}
else if (_currentTextField == _viewController.diversion2TextField)
{
[_viewController setChooseAirport2:cDict];
}
}
【问题讨论】:
-
我在你的 zip 文件中只得到 iOS 6 图像。
-
您使细胞重复使用成为不可能。你永远不应该那样做。
-
将图片托管在任何提供商处链接它们,有人会将其包含为图片。
-
图片已更新
-
我怎样才能使细胞重复使用成为可能?
标签: ios objective-c uitableview ios6 ios7