Christian R
Christian R

Reputation: 1563

Indenting a custom table view cell

I have created a custom UITableViewCell using Storyboard. The cell contains 3 UILabel items. When the edit button is hit. The (-) sign slides in on the left but the cell does not indent and the (-) sign covers one of the UITextLabels.

I was wondering what is the best way to make all 3 UITextLabels indent when the edit button is hit. I have tried adding the 3 labels to a UIView (contentView) and adding it to the contentsView:

-(void)layoutSubviews {

[super layoutSubviews];
[self.contentView addSubview:self.theContent];

}

Although this renders the same result. Any suggestions?

Upvotes: 1

Views: 1574

Answers (2)

ZHZ
ZHZ

Reputation: 2098

You can set it in storyboard like this. enter image description here

Upvotes: 1

Dima
Dima

Reputation: 23624

What is the frame of theContent? Have you tried modifying the frame (subtracting from the 'x' value the amount you want it to be indented)? You can even do this in a nice animation:

[UIView beginAnimations : @"cell edit" context:nil];
[UIView setAnimationDuration:1];

CGRect frame = theContent.frame;
frame.origin.x -= 40; // add or subtract here however much you want to indent and in which direction
theContent.frame = frame;   

[UIView commitAnimations];

Upvotes: 1

Related Questions