UA-17470720-3

Jump to content


Photo
- - - - -

Phantom spacing between custom cells?

cells bug

  • Please log in to reply
3 replies to this topic

#1 Jeremie Weldin

Jeremie Weldin

    Sr. Member

  • STV 3.0 Pro
  • PipPipPip
  • 47 posts
  • LocationSummerville, SC, USA
Reputation: 7
Good

Posted 11 December 2012 - 04:25 PM

When using custom cells, I keep seeing extra space at the bottom of some of the custom cells. If it happens for one instance of a custom cell it happens for all of them. I can clear up some of the spaces by calling reloadData on the modeledTableView after the view has appeared. However, this creates a subtle jump in the cells and is not optimal.

Other custom cells just add a thin space filled with the background color of the cell, but not quite as long as the custom cell.

I have attempted several projects and this has happened in all of them when using custom cells. What am I doing wrong?

Please check out the screencast linked below to see what I am talking about.

<link removed>

Edited by Jeremie, 11 December 2012 - 07:09 PM.


#2 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 11 December 2012 - 04:39 PM

Hi Jeremie,

Thank you very much for the screen cast, that was really helpful!

Here is what I think the issue is: even though your cell's height is 30px, STV will always attempt to automatically resize your cell to fit its contents. It seems that one of the views inside the cell has a height that's a bit larget than 30px, which is causing STV to add the extra few pixels. You could do one of the following:

a. In Interface Builder, make sure that all views are within the 30px bounds.

b. Disable STV's automatic cell resizing for this specific section, in which case STV will directly use the 30px height you specified. The easiest way to implement this is the following:
mySection.cellActions.willConfigure = ^(SCTableViewCell *cell, NSIndexPath *indexPath)
{
  if([cell isKindOfClass:[SCCustomCell class]])
  {
    SCCustomCell *customCell = (SCCustomCell *)cell;
    customCell.autoResize = FALSE;
  }
};

Let me know if this works for you.

#3 Jeremie Weldin

Jeremie Weldin

    Sr. Member

  • STV 3.0 Pro
  • PipPipPip
  • 47 posts
  • LocationSummerville, SC, USA
Reputation: 7
Good

Posted 11 December 2012 - 07:00 PM

That worked for the first issue, the blank line just below the header that would go away when reloading data is now displaying without the spacer. However, the second issue is exactly the same. :( I have painstakenly looked over EVERY element in the cell and they are all within the frame. Anything else that it could be?

#4 Jeremie Weldin

Jeremie Weldin

    Sr. Member

  • STV 3.0 Pro
  • PipPipPip
  • 47 posts
  • LocationSummerville, SC, USA
Reputation: 7
Good

Posted 11 December 2012 - 07:05 PM

Actually, that did fix my issue. For some reason, after I run the project, IB changes the cell to be 31 high rather than 30. I changed it back and it works fine. Now I just need to find out why IB is modifying my cell height. :( I am assuming that that has nothing to do with STV, however. Thanks for the help!





Also tagged with one or more of these keywords: cells, bug

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users