UIImageView丢失动画的UITableViewCell(iOS 5错误?)

UIImageView丢失动画的UITableViewCell(iOS 5错误?),uitableview,cocoa-touch,animation,ios5,Uitableview,Cocoa Touch,Animation,Ios5,到目前为止,这对我来说效果很好——但在iOS 5中,当我在分组的tableview上的常规UITableViewCell上有一个imageView,并将表格从编辑设置为不编辑时,动画将丢失,文本和图像视图只是弹回原位,而不是滑动。我没有重新加载任何东西——我把代码精简到几乎没有任何东西来解决这个问题,然后我才想到简单地注释掉我说的那一行 cell.imageView.image = [UIImage imageNamed:@"image.png"]; 然后一切都很顺利。这是iOS 5中的一个b

到目前为止,这对我来说效果很好——但在iOS 5中,当我在分组的tableview上的常规UITableViewCell上有一个imageView,并将表格从编辑设置为不编辑时,动画将丢失,文本和图像视图只是弹回原位,而不是滑动。我没有重新加载任何东西——我把代码精简到几乎没有任何东西来解决这个问题,然后我才想到简单地注释掉我说的那一行

cell.imageView.image = [UIImage imageNamed:@"image.png"];
然后一切都很顺利。这是iOS 5中的一个bug吗

编辑:到目前为止,我认为交付的tableview单元格的UIImageView存在问题。对于自定义单元格和不带imageView的UITableViewCell,似乎设置不编辑动画是可以的。我很想找到一种方法来解决这个问题,这会让事情看起来不专业

下面是我所说的分组表视图部分的代码,这是cellforrowatindexPath的一部分:

static NSString *CellIdentifier = @"ItemDetailDefaultCell";
            UITableViewCell *cell = (UITableViewCell *)[tableView1 dequeueReusableCellWithIdentifier:CellIdentifier];
            if (cell == nil) {
                cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
                cell.backgroundColor = [[UIApplication sharedDelegate] defaultCellBackgroundColor];

                cell.textLabel.backgroundColor = [UIColor clearColor];
                cell.textLabel.shadowOffset = CGSizeMake(0.0, 1.0);

                cell.detailTextLabel.backgroundColor = [UIColor clearColor];

                cell.detailTextLabel.font = detailTextLabelFont;
                cell.detailTextLabel.adjustsFontSizeToFitWidth = YES;
                cell.detailTextLabel.minimumFontSize = DETAIL_TEXT_LABEL_MINIMUM_FONT_SIZE;

                cell.detailTextLabel.textColor = [[UIApplication sharedDelegate] defaultDetailTextColor];
                cell.detailTextLabel.shadowColor = [[UIApplication sharedDelegate] defaultDetailShadowColor];
                cell.detailTextLabel.shadowOffset = CGSizeMake(0.0, 1.0);
            }
            else {
                UIView* subview;
                while ((subview = [[[cell contentView] subviews] lastObject]) != nil)
                    [subview removeFromSuperview];
                cell.textLabel.text = nil;
                cell.detailTextLabel.text = nil;
            }
            cell.selectionStyle = [[UIApplication sharedDelegate] defaultCellSelectionStyle];
            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            cell.editingAccessoryType = UITableViewCellAccessoryDisclosureIndicator;
            cell.accessoryView = nil;
            cell.editingAccessoryView = nil;

            cell.autoresizingMask = UIViewAutoresizingFlexibleWidth;
            cell.contentMode = UIViewContentModeLeft;

            cell.textLabel.textColor = [[UIApplication sharedDelegate] defaultMainTextColor];
            cell.textLabel.shadowColor = [[UIApplication sharedDelegate] defaultMainShadowColor];
            cell.textLabel.font = textLabelFont;
            cell.textLabel.adjustsFontSizeToFitWidth = YES;
            cell.textLabel.minimumFontSize = TEXT_LABEL_MINIMUM_FONT_SIZE;

            [(UACellBackgroundView *)cell.backgroundView setHeader:NO];
            if (row < itemsCount) {
                [(UACellBackgroundView *)cell.backgroundView setPosition:UACellBackgroundViewPositionMiddle];
            }
            else {//row == items.count
                if (self.editing) {
                    [(UACellBackgroundView *)cell.backgroundView setPosition:UACellBackgroundViewPositionMiddle];
                }
                else {
                    [(UACellBackgroundView *)cell.backgroundView setPosition:UACellBackgroundViewPositionBottom];
                }
            }
            cell.textLabel.text = item.name;
            cell.imageView.image = [UIImage imageNamed:@"status1.png"];
return cell;
静态NSString*CellIdentifier=@“ItemDetailDefaultCell”;
UITableViewCell*单元格=(UITableViewCell*)[tableView1 dequeueReusableCellWithIdentifier:CellIdentifier];
如果(单元格==nil){
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle重用标识符:CellIdentifier]自动释放];
cell.backgroundColor=[[UIApplication sharedDelegate]defaultCellBackgroundColor];
cell.textLabel.backgroundColor=[UIColor clearColor];
cell.textlab.shadowOffset=CGSizeMake(0.0,1.0);
cell.detailTextLabel.backgroundColor=[UIColor clearColor];
cell.detailTextLabel.font=detailTextLabelFont;
cell.detailTextLabel.adjustsFontSizeToFitWidth=是;
cell.detailTextLabel.minimumFontSize=详细信息\文本\标签\最小字体\大小;
cell.detailTextLabel.textColor=[[UIApplication sharedDelegate]defaultDetailTextColor];
cell.detailTextLabel.shadowColor=[[UIApplication sharedDelegate]defaultDetailShadowColor];
cell.detailtextlab.shadowOffset=CGSizeMake(0.0,1.0);
}
否则{
UIView*子视图;
而((子视图=[[cell contentView]子视图]lastObject])!=nil)
[子视图从SuperView移除];
cell.textlab.text=nil;
cell.detailTextLabel.text=nil;
}
cell.selectionStyle=[[UIApplication sharedDelegate]默认CellSelectionStyle];
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
cell.editingAccessoryType=UITableViewCellAccessoryDisclosureIndicator;
cell.accessoryView=nil;
cell.editingAccessoryView=nil;
cell.autoresizingMask=uiviewsautoresizingflexiblewidth;
cell.contentMode=UIViewContentModeLeft;
cell.textLabel.textColor=[[UIApplication sharedDelegate]defaultMainTextColor];
cell.textLabel.shadowColor=[[UIApplication sharedDelegate]defaultMainShadowColor];
cell.textLabel.font=textLabelFont;
cell.textlab.adjustsFontSizeToFitWidth=是;
cell.textlab.minimumFontSize=文本\标签\最小字体\大小;
[(UACellBackgroundView*)cell.backgroundView集头:否];
如果(行
是否使用此方法进入编辑模式

[myTable setEditing:否动画:是]


另外,如果您正在重新加载数据,也将取消动画。

您可以提供更多此类代码,或者使用该方法创建新项目并仅在其中测试imageView吗。如我所知,不重新加载tableview会取消动画(请参见原始问题)。