Welcome, Guest
Username Password: Remember me

SCTableViewCell Width
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: SCTableViewCell Width

SCTableViewCell Width 1 year, 5 months ago #1

Hi All,

I have a custom background view that I am assigning to the .backgroundView property of my SCTableViewCells in the - (void)tableViewModel:(SCTableViewModel *)tableViewModel willDisplayCell:(SCTableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath method.

However, the width of the image that I am using is 304 points and the table view cell appears to be marginally narrower (maybe two or three points) so the view (which contains an image, amongst other things) is being slightly squashed, and given the intricacies of this image it makes it look quite distorted. Is there an easy way in code to modify the width of the cell? I have tried in the willConfigureCell: method to set the cell.frame = CGRect(...) but that does not make a difference. I would also prefer not to design an entirely custom cell in IB (using STV 2.0) as this that seems like a lot of overhead for such a minor modification to the cell.

Thanks,
Matthew
  • skoota
  • OFFLINE
  • Expert Boarder
  • Posts: 89
  • Karma: 2

Re: SCTableViewCell Width 1 year, 4 months ago #2

Hi Matthew,

By design, a UITableView (and not STV) does not allow you to have cells that are of different width than the table view itself. However, you can always give the illusion that the cell is narrower by creating a transparent cell, then adding a UIView to it with your required dimensions. Hope that makes sense, please tell me if you need more help
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: SCTableViewCell Width 1 year, 4 months ago #3

Thanks Tarek. That confirmed my thoughts.

Best wishes,
Matthew
  • skoota
  • OFFLINE
  • Expert Boarder
  • Posts: 89
  • Karma: 2
  • Page:
  • 1
Time to create page: 0.78 seconds