我们在这里有一个非常定制的“可调通”号。 因此,它基本上看着这一点:
+----------------+
+ Image view +
+ (230px height) +
+----------------+
+ Content +
+ Content +
+ Overall 340px +
+----------------+
我想做的是:在图像结束的地方,以及在桌子结束的地方(没有背景重复或任何事情)上,向细胞添加一个背景形象。
因此,我这样做了:
// Custom UITableViewCell class, this is part of a method that gets called
// in an overriden -layoutSubviews
UIImage *watermarkImage = [UIImage imageNamed:@"myBackground.png"];
int watermarkWidth = watermarkImage.size.width;
int watermarkHeight = watermarkImage.size.height;
int watermarkX = screenWidth - watermarkWidth;
int watermarkY = imageView.frame.size.height + 10;
CGRect watermarkFrame = CGRectMake(watermarkX, watermarkY, watermarkWidth, watermarkHeight);
UIImageView *watermarkImageView = [[UIImageView alloc] initWithFrame:watermarkFrame];
[watermarkImageView setImage:watermarkImage];
[self setBackgroundView:watermarkImageView];
这一工作相对较好,但图象大于
What can I do to make the backgroundView respect the cell boundaries? Setting clipsToBounds
to YES didn t work.