Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/113.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 设置UIScrollView背景图像_Ios_Uiscrollview - Fatal编程技术网

Ios 设置UIScrollView背景图像

Ios 设置UIScrollView背景图像,ios,uiscrollview,Ios,Uiscrollview,我有一个滚动视图,它占据了视图的全部显示大小。我想将背景设置为静态图像。我不想平铺它,所以我认为我不能使用背景色。另外,我并不真的希望它在滚动视图后面(将滚动视图设置为透明),因为我希望bg与滚动视图一起滚动 任何帮助都会很好。谢谢 只需添加一个与滚动视图内容大小相同的UIImageView即可尝试将可耕地图像设置为背景色 scrollView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"tile

我有一个滚动视图,它占据了视图的全部显示大小。我想将背景设置为静态图像。我不想平铺它,所以我认为我不能使用背景色。另外,我并不真的希望它在滚动视图后面(将滚动视图设置为透明),因为我希望bg与滚动视图一起滚动


任何帮助都会很好。谢谢

只需添加一个与滚动视图内容大小相同的UIImageView即可

尝试将可耕地图像设置为背景色

scrollView.backgroundColor = [UIColor colorWithPatternImage:[UIImage  imageNamed:@"tileableImage.png"]];

当我们将图像设置为scrollview作为背景时,就会使用scrollview进行滚动。因此,与其将图像设置为背景,不如将图像设置为视图

 self.view.backgroundColor = UIColor(patternImage: UIImage(named: "bg.jpg")!)

scrollView.backgroundColor=UIColor(patternImage:UIImage(name:imageName))