【发布时间】:2012-08-08 06:06:02
【问题描述】:
我是 iPhone 新手,
我想在 ScrollView 中重复我的 PatternImage。
逻辑:768bg.gif 是我的图像,我将此图像添加到UIImageView,然后将 Imageview 添加到UIScrollView,但图像没有重复。
这是我的代码 sn-p,
CGRect scrollViewFrame = CGRectMake(0, 0, 1000, 600);
UIScrollView *scrollVw = [[UIScrollView alloc] initWithFrame:scrollViewFrame];
[self.view addSubview:scrollVw];
[scrollVw release];
UIImage *image1 = [UIImage imageNamed:@"768bg.gif"];
self.imageView = [[UIImageView alloc] initWithImage:image1];
[scrollVw addSubview:self.imageView];
scrollVw.contentSize = CGSizeMake(image1.size.width+100, image1.size.height+100);
我们将不胜感激。
【问题讨论】:
-
重复是什么意思??解释清楚..
-
我想重复 PatternImage。
-
是的,我尝试了这个
UIImage *image1 = [UIImage imageNamed:@"768bg_with_footer.gif"]; self.imageView = [[UIImageView alloc] initWithImage:[self.view setBackgroundColor:[UIColor colorWithPatternImage:image1]]];,但显示将void参数发送到UIImage时出错 -
检查我的答案 stackoverflow.com/questions/11758704/… 将 col 固定为 3 并将 row 固定为无限
-
[self.view] 不会给出图像,所以我认为你应该检查 Tejeshwar Gill 的答案。这是正确的。
标签: iphone ipad uiscrollview uiimageview uiimage