我正在制作简单的游戏,您可以使用以下代码选择背景图像:
-(IBAction)FirstButtonPressed:(id)sender
{
UIGraphicsBeginImageContext(self.view.frame.size);
[[UIImage imageNamed:@"picture4.jpg"] drawInRect:self.view.bounds];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
self.view.backgroundColor = [UIColor colorWithPatternImage:image];
//[[self parentViewController] dismissModalViewControllerAnimated:YES]; <-- Not returning to previous view
}
我无法弄清楚哪个是在上一个视图中返回用户的相应代码。上面的未注释代码不起作用,选择图像,但保持在当前视图中。有任何想法吗?感谢