Strange animation while editing a custom cell?

I created UITableViewCellin Xcode 4 using IB. But for some strange reason, when I launch my edit button, it cellacts really strange and does not have the same animation as a regular table cell. I do not know what is happening, I tried to implement -(void)setEditing:(BOOL)editing animated:(BOOL)animatedcells in my custom class, but nothing works.

UPDATE: Mine ViewController, which I use in the cell, has this code below cellForAtIndexto display the cell.

CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if(cell == nil)
    {
    NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:nil options:nil];
    for (id currentObject in topLevelObjects) 
    {
        if ([currentObject isKindOfClass:[UITableViewCell class]]) 
        {
            cell = (CustomCell *) currentObject;
            break;
        }
        return cell;
    }
}

Normal view:

The normal view

When you click the edit button:

enter image description here

edit

And even when scrolling, it closes the text when it should move it aside:

enter image description here

0
source share
1 answer

; IB UITableViewCell s.

; , - UITableViewCell contentView... . (, ), UITableViewCell contentView . UIViewAutoresizing UILabel/, contentView, /.

, :

. , , ad-hoc. , , , /etc.

ad-hoc.

UIImageView * myCheckBox = ...
UILabel * myLabel = ...
UITableViewCell * cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
[cell.contentView addSubview:myCheckBox];
[cell.contentView addSubview:myLabel];
self.customCell = cell;

# 2

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.textLabel.frame = CGRectMake(50, self.textLabel.frame.origin.y, self.contentView.frame.size.width - 50, self.textLabel.frame.size.height);
}
+2

All Articles