我有 2scrollviews和 1 imageview。
现在在 Main 里面scrollview我有另一个scrollview,在这个里面scrollview我有图像。
所以,我的主Scrollview命名为“ ScrollView”,子scrollview命名为“ scrView”
现在我可以在scrView里面添加“ ScrollView”但是我看不到里面的图片“ scrView”
我的编码如下:
int numberOfPages = 10;
[scrollView setPagingEnabled:YES];
[scrollView setContentSize:CGSizeMake(scrollView.bounds.size.width * numberOfPages, scrollView.bounds.size.height)];
CGRect pageFrame;
CGRect imageFrame;
UIImageView *imageView;
for(int i=0; i < numberOfPages; i++)
{
pageFrame = CGRectMake(i * scrollView.bounds.size.width+50, 0.0f, scrollView.bounds.size.width-100, scrollView.bounds.size.height);
UIScrollView *scrView = [[UIScrollView alloc] init];
imageFrame = CGRectMake(i * scrView.bounds.size.width, 0.0f, scrView.bounds.size.width, scrView.bounds.size.height);
imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image1.jpg"]];
[scrView setFrame:pageFrame];
[imageView setFrame:imageFrame];
[scrView setBackgroundColor:[UIColor redColor]];
[scrollView addSubview:scrView];
[scrView addSubview:imageView];
[imageView release];
}
如果您查看我添加的代码imageView,subView但scrView我无法在模拟器中看到图像。
问题是什么?
和我分享你的想法。
谢谢...