问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/1928631/uitableviewcell-reorganize-subviews-when-the-delete-button-appears