
I want to add horizontal padding for my table cells as shown.
I created a subclass of UITableViewCell whose width was 314 pixels (screen width - 320), and set its frame in the initWithCoder :
[self customizeXPosition:self.profileImage]; [self customizeXPosition:self.birthdayLabel]; [self customizeXPosition:self.heightLabel]; [self customizeXPosition:self.weightLabel];
this is mine - (void)customizeXPosition:(UIView *)view :
- (void)customizeXPosition:(UIView *)view { CGRect tmpRect = view.frame; tmpRect.origin.x += 3.0; view.frame = tmpRect; }
The custom cell was smaller than the screen, and I moved each element in the cell 3 pixels to the right. I thought this code should achieve my goal, but it is not. The view has not changed in the simulator, just as I did not write any code.
How can I achieve my goal?
source share