Ios UITableViewCell在DidSelectRowatineXpath中比CellForRowatineXpath短1倍
我在Ios UITableViewCell在DidSelectRowatineXpath中比CellForRowatineXpath短1倍,ios,objective-c,uitableview,cocoa-touch,uikit,Ios,Objective C,Uitableview,Cocoa Touch,Uikit,我在tableView:cellforrowatinexpath:中创建了一个UITableViewCell。在这种方法中,我称之为: UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease]; NSLog(@"Cell height: %f", cell.contentView.frame.size.h
tableView:cellforrowatinexpath:
中创建了一个UITableViewCell。在这种方法中,我称之为:
UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease];
NSLog(@"Cell height: %f", cell.contentView.frame.size.height);
这给了我一个返回值44.000000
然后在我的tableView:didSelectRowAtIndexPath:
方法中,我调用:
UITableViewCell *cell = [tableView cellForRowAtIndexPath: indexPath];
NSLog(@"Cell height: %f", cell.contentView.frame.size.height);
这给了我一个
43.000000
的返回值。他们不是同一个牢房吗?给出了什么?这可能是由于分离器。你看过了吗?我会把这张照片塞进苹果的幕后魔术。你知道如何让它正确显示吗?除了在第二个高度加1之外?对我来说似乎有点黑客。它显示的不对吗?你能直观地看到单元格收缩吗?没有,但我有一个UIImageView(复选框),其中使用cRectOffset()进行放置。我计算帧的高度,以便定位它,然后在选择行时更改图像。但当新图像出现时,它会将自身向上移动1像素。我只需添加一个像素就可以解决这个问题,但它看起来很粗糙。也许我只是太紧张了。这看起来确实有点刻薄,但我想有时候你必须刻薄。对不起,我的回答很蹩脚。