【问题标题】:How can I make a variable background image in my iOS APP如何在我的 iOS APP 中制作可变背景图片
【发布时间】:2011-01-08 11:37:32
【问题描述】:

我正在制作一个 iPhone 应用程序,我想知道如何使可变背景图像成为用户可以选择其中一个选项的背景?

【问题讨论】:

标签: iphone xcode uiimage


【解决方案1】:

我不知道你在前台想要什么,但任何基于 UIView 类的东西都有一个backgroundColor 属性,你可以将它设置为这样的图像:

yourView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"YourImage.png"]];

【讨论】:

    【解决方案2】:

    它对我不起作用,它起作用的是:

    self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"background.png"]];
    

    我认为是一样的,但不知道为什么其他答案对我不起作用。

    希望对你有帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-03-14
      • 2016-01-27
      • 1970-01-01
      • 1970-01-01
      • 2012-04-17
      • 1970-01-01
      • 2012-05-25
      相关资源
      最近更新 更多