UITableViewCell is 1px shorter in didSelectRowAtIndexPath than cellForRowAtIndexPath

Posted by Calvin L on Stack Overflow See other posts from Stack Overflow or by Calvin L
Published on 2010-06-02T01:33:09Z Indexed on 2010/06/02 1:43 UTC
Read the original article Hit count: 358

I have a UITableViewCell that I create in tableView:cellForRowAtIndexPath:. In that method I call:

UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease];
NSLog(@"Cell height: %f", cell.contentView.frame.size.height);

This gives me a return value of 44.000000.

Then in my tableView:didSelectRowAtIndexPath: method, I call:

UITableViewCell *cell = [tableView cellForRowAtIndexPath: indexPath];
NSLog(@"Cell height: %f", cell.contentView.frame.size.height);

And this gives me a return value of 43.000000. Aren't they the same cell? What gives?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa