Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/36.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
Iphone 使用Quartz2d和上下文插入背景图像?_Iphone_Xcode_Uiimageview_Quartz 2d - Fatal编程技术网

Iphone 使用Quartz2d和上下文插入背景图像?

Iphone 使用Quartz2d和上下文插入背景图像?,iphone,xcode,uiimageview,quartz-2d,Iphone,Xcode,Uiimageview,Quartz 2d,我用Quartz2d写了一个游戏。我想在游戏中插入背景图片。我尝试过使用view.insertSubView方法来实现这一点,但是背景图像总是放在其他精灵的顶部。即使使用sendSubviewToBack也不能解决这个问题。我假设我需要以某种方式将背景图像直接绘制到上下文上 提前感谢您的帮助 马丁你可以用 UIImage *myImage = [UIImage imageNamed:@"imageName.png"]; [myImage drawAtPoint:CGPointMake(0, 0)

我用Quartz2d写了一个游戏。我想在游戏中插入背景图片。我尝试过使用view.insertSubView方法来实现这一点,但是背景图像总是放在其他精灵的顶部。即使使用sendSubviewToBack也不能解决这个问题。我假设我需要以某种方式将背景图像直接绘制到上下文上

提前感谢您的帮助


马丁

你可以用

UIImage *myImage = [UIImage imageNamed:@"imageName.png"];
[myImage drawAtPoint:CGPointMake(0, 0)];
但是如果它总是一样的话,你可能应该在你的UIView下面添加一个UIImageView来绘制你的所有游戏^^^(但不是像你尝试的那样在视图中,而是在superview中)