我有这个代码来创建我原来的 UIView:
itemView = [[UIView alloc] initWithFrame:CGRectMake(self.frame.size.width - CELL_HEIGHT - 10, 0, CELL_HEIGHT, CELL_HEIGHT)];
itemView.backgroundColor = [UIColor redColor];
[self addSubview:itemView];
然后我稍后会有这段代码:
UIImageView *accessory = [[UIImageView alloc] initWithFrame:cell.itemView.frame];
accessory.contentMode = UIViewContentModeCenter;
accessory.image = [UIImage imageNamed:@"icon_settings_fwd.png"];
itemView = accessory;
但我看到的只是红色。它没有用 UIImage 替换它。有人知道为什么吗?