Note: It’s obvious that the width is 300. I am not entirely sure because after I give a cell with 300 width, the cell is resized to 320. The reason I asked is because in one case I give 300 and in another I give 320 and both works fine. I wonder if there is an official way.
I am not asking what the width of the cell for grouped cell. I am asking what’s the width of the cell that I should supply. I sometimes send 300 width cells and 320 cells without problem.
I use xib and subclass the UITableViewCell. Has done it multiple times. It works. I am just curious if there is just some official documentation that when groupped you need to return tableViewCell that’s 20 points narrower than UITableViewCell, because I am not seeing that anywhere.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSUInteger row = [indexPath row];
NearbyShortcutTableViewCell * cell;
if([self.arrayOfItems[row] isNotEmpty]){
cell=(NearbyShortcutTableViewCell *)self.arrayOfItems[row];
}
PO(cell);
PO(cell.superview);
PO(cell.superview.superview);
return cell;
}
cell.superview.superview: (null)
cell: <NearbyShortcutTableViewCell: 0x89a8300; baseClass = UITableViewCell;
frame = (0 0; 300 50); layer = <CALayer: 0x89a8420>>
cell.superview: (null)
cell.superview.superview: (null)
cell: <NearbyShortcutTableViewCell: 0x89a9030; baseClass = UITableViewCell; frame = (0 0; 300 50); layer = <CALayer: 0x89f3d60>>
cell.superview: (null)
cell.superview.superview: (null)
cell: <NearbyShortcutTableViewCell: 0x8bbf5e0; baseClass = UITableViewCell; frame = (0 754; 320 50); autoresize = W; layer = <CALayer: 0x8bbf700>>
cell.superview: (null)
cell.superview.superview: (null)
cell: <NearbyShortcutTableViewCell: 0x8bb48b0; baseClass = UITableViewCell; frame = (0 704; 320 50); autoresize = W; layer = <CALayer: 0x8bbe6d0>>
cell.superview: (null)
cell.superview.superview: (null)
cell: <NearbyShortcutTableViewCell: 0x8bb4050; baseClass = UITableViewCell;
frame = (0 654; 320 50); autoresize = W; layer = <CALayer: 0x8bbe2c0>>
So in the beginning I provide a 300 width cell. Somehow it got resized into 320. However, everything remains “fine”
Actually should I provide a 300 width cell or a 320 width cell anyway?
It seems that no matter the size of the cell that I provide, the cell itself will be resized to the width of the tableViewCell. I just don’t want to handle the subviews layouting when size is resized.
The standard size for a Plain
UITableVIewCellis 320 x 44 where as a Grouped cell is about 300 x 44 (with a border on either side of 10). You can change this to whatever you want as it all depends on the content and preference of you the developer on how you want to present your views.Typically, if you are n’t doing anything fancy with the tableView, (i.e its going to fill the whole screen), you can just skip sizing the cells or table altogether.