Reputation: 1
I have a problem with a UITableCellView
. When the delete button shows up, it messes up my table row.
For example:
-------------------
blah blah blah blah
-------------------
line 2
-------------------
so on...
-------------------
... and after I tried to swipe to delete on line 1,
--------------------
blah blah [delete]
blah ---------------
blah 2
--------------------
so on...
--------------------
Not sure how to fix this.
Is there anyway to make UITableCellView
not shrink when the delete button shows up?
Just to clarify, I have subclassed the UITableCellView
with an overwritten layoutSubviews
, but in a very, very simple way. I just put my labels and calculate size and stuff, very basic.
If you try the same thing on mail app or facebook app, the delete button just go over the content of table cell row. How can I do that?
Upvotes: 0
Views: 1376
Reputation: 15629
Not sure if this helps or not since this question is fairly old. However, I had 3 UI elements in my table cell and they were not being handled properly on swipe.
Took me a while to finally figure out that after I changed the "Line Breaks" to "Clip" did everything work properly.
Oh and if you have a text field/label to auto-resizing it will mess up the layout too during the swipe action.
Upvotes: 0
Reputation: 6545
If you don't want your cell's subviews to be shrunk in editing mode, try setting the autoresizingMask
of your cell's subviews to:
_messageLabel.autoresizingMask = UIViewAutoresizingNone;
Upvotes: 0
Reputation: 2128
You will have to use the
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
[super setEditing:editing animated:animated];
if (editing) {
// EDITING state
// You can describe animations here
} else {
// NORMAL state
}
}
method to describe the changes, in your UITableViewCell
subclass
Upvotes: 1
Reputation: 44633
You need to set the lineBreakMode
for the label.
label.lineBreakMode = UILineBreakModeTailTruncation;
Upvotes: 0