【发布时间】:2010-07-16 15:58:52
【问题描述】:
我有一个滚动视图,其中有一个UIView,其中包含内容。我添加了一个UIImageView 作为UIScrollView 的子对象(所以它应该在内容容器的顶部),这适用于iPhone 3.2+,但在运行3.1.3 的iPhone 上,图像没有显示在上面容器。我的代码是这样的:
// add the content container
UIView *contentContainer = [[UIView alloc] init];
[scrollView addSubview:contentContainer];
// add content, etc
// this works in 3.2+
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
[scrollView addSubview:imageView];
// tried adding this for 3.1, but still didn't work
[scrollView bringSubviewToFront:imageView];
[imageView setFrame:CGRectMake(point.x, point.y, image.size.width, image.size.height)];
我还有什么遗漏的吗?谢谢!
【问题讨论】:
标签: iphone uiscrollview addsubview