我可以为视图设置自己的背景图片吗?我不想使用UIImageView控件。在IB中似乎无法实现。我需要通过编程来实现吗?
谢谢。
我可以为视图设置自己的背景图片吗?我不想使用UIImageView控件。在IB中似乎无法实现。我需要通过编程来实现吗?
谢谢。
资源浪费,使用:
[[self view] setBackgroundColor: [UIColor colorWithPatternImage: [UIImage imageNamed:@"background.png"]]];
self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"plain_bg.png"]];
UIColor *background = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"pic.png"]];
self.view.backgroundColor = background;
试试这个,对我来说有效
UIImageView出了什么问题吗?这是它的完美用途。
我真的不认为以这种方式使用backgroundColor是正确的做法。个人而言,我会创建一个UIImageView并将其插入到您的视图层次结构中。