Cocoa touch 试图找到在UIView中绘制UIImage的适当上下文
我试图在我的UIView中绘制背景图像。这在UIAlertView委托方法alertView中: 我弹出上下文是因为在此之前,我在OpenGL视图中使用了一个名为game的上下文Cocoa touch 试图找到在UIView中绘制UIImage的适当上下文,cocoa-touch,Cocoa Touch,我试图在我的UIView中绘制背景图像。这在UIAlertView委托方法alertView中: 我弹出上下文是因为在此之前,我在OpenGL视图中使用了一个名为game的上下文 UIGraphicsPopContext(); UIImage* background = [UIImage imageNamed:@"Background.png"]; [background drawAtPoint:CGPointMake(0.0, 0.0)]; // fade the game out [UIV
UIGraphicsPopContext();
UIImage* background = [UIImage imageNamed:@"Background.png"];
[background drawAtPoint:CGPointMake(0.0, 0.0)];
// fade the game out
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
[game setAlpha:0];
[UIView commitAnimations];
[game release];
我收到一堆错误消息,例如:CGContextSaveGState:invalid context
我试了一下,没有弹出来。
我想我需要做的是找到我的UIView的CGContextRef,并将其设置为我的当前上下文,但是文档中没有关于CGContextRef的信息。
如何显示我的图像?我试图在游戏视图淡出时显示其背后的图像
谢谢。问题解决了。我所要做的就是将UIImage放在UIImageView中,并将其添加到视图的子视图中。。我所要做的就是将UIImage放在UIImageView中,并将其添加到视图的子视图中。@hyn是对的! 举个例子:
UIImageView *logoView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"38-airplane.png"]];
@hyn是对的!
举个例子:
UIImageView *logoView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"38-airplane.png"]];