【发布时间】:2011-01-08 11:37:32
【问题描述】:
我正在制作一个 iPhone 应用程序,我想知道如何使可变背景图像成为用户可以选择其中一个选项的背景?
【问题讨论】:
我正在制作一个 iPhone 应用程序,我想知道如何使可变背景图像成为用户可以选择其中一个选项的背景?
【问题讨论】:
我不知道你在前台想要什么,但任何基于 UIView 类的东西都有一个backgroundColor 属性,你可以将它设置为这样的图像:
yourView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"YourImage.png"]];
【讨论】:
它对我不起作用,它起作用的是:
self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"background.png"]];
我认为是一样的,但不知道为什么其他答案对我不起作用。
希望对你有帮助。
【讨论】: