【发布时间】:2014-02-26 06:10:54
【问题描述】:
我必须得到 NSMutableArray 的 IndexPath 值。当当时选择特定单元格时,我必须执行操作,它的 IndexPath 存储在 NSMutableArray 中并且特定单元格高度正在增加。当我在那个时候再次按下那个单元格时,特定的单元格高度正在减小。这怎么可能,我必须提出什么样的条件?
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"%@",indexPath);
selectIndexPathCell = indexPath;
NSIndexPath *previousSelectedIndexPath = selectIndexPathCell;
selectIndexPathCell = indexPath;
if (previousSelectedIndexPath) {
[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:previousSelectedIndexPath]
withRowAnimation:UITableViewRowAnimationAutomatic];
}
[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:selectIndexPathCell]
withRowAnimation:UITableViewRowAnimationAutomatic];
self.selectedRow = sections_main[indexPath.section][@"content"][indexPath.row];
[tblPeople beginUpdates];
[tblPeople endUpdates];
}
- (CGFloat)tableView:(UITableView *)aTableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if(selectIndexPathCell != nil && [selectIndexPathCell compare:indexPath] == NSOrderedSame){
return 80;
}else{
return 60.0;
}
}
【问题讨论】:
标签: ios iphone uitableview custom-cell