cell我是用xib创建的,然后每次在heightForRowAtIndexPath 方法里面,直接返回cell的高度
然后点击,我直接 reloadData
发现在group下,每次点击,行高的高度都会+2
然后点击,我直接 reloadData
发现在group下,每次点击,行高的高度都会+2
原因还没有找到,很奇怪
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[testTableview reloadData];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
switch (indexPath.section) {
case 0:
{
NSLog(@"%f",cellTest.frame.size.height);
return cellTest.frame.size.height;
}
break;
case 1:
{
NSLog(@"%f",cellText2.frame.size.height);
return cellText2.frame.size.height;
}
break;
default:
break;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section==0) {
return cellTest;
}else{
return cellText2;
}
}