【发布时间】:2011-11-14 18:05:46
【问题描述】:
第一个 UIImageView 使用框架 (0,38,250,250) 创建,第二个 UIImageView 使用第一个视图的框架创建并添加为第一个图像视图的子视图。结果显示第一个图像视图没有完全被第二个图像视图覆盖。为什么两个视图不重叠?我分配了两个不同背景颜色的图像视图,这样更容易看到。
UIImageView *firstView = [[[UIImageView alloc] initWithFrame:CGRectMake(0,38,250,250)] autorelease];
[firstView setBackgroundColor:RGBACOLOR(36, 39, 39, 0.8)];
[self.view addSubview:firstView];
UIImageView *itemPic = [[[UIImageView alloc] initWithFrame:firstView.frame] autorelease];
itemPic.image = [UIImage imageNamed:@"color_c.png"];
[itemPic setBackgroundColor:RGBACOLOR(150, 150, 35, 0.8)];
[firstView addSubview:itemPic];
【问题讨论】:
标签: iphone objective-c cocoa-touch uiimageview