views:

154

answers:

1

Hi everyone!

Does anyone knows any method to resize subviews(I.E. UILabelView) when Delete button appears.

There could be two methods:

1.Capture a notification, if there's one, when the button appears in the UITableViewCell 2.Tell the framework re-arange it automatically.

+3  A: 

In your UITableViewCell class's .m file use layoutSubviews. It is called every time the cell is resized, the delete button appears/disappears, and more:

- (void) layoutSubviews {

 [super layoutSubviews];


 frame = self.contentView.bounds; ///this is the availalbe space for the cell
 ///it's automatically adjusted when the delte button appears
 ///so use it to resize all of your interface elements
}

You can also use if (self.editing) { inside of layoutSubviews for more control.

mjdth