xcode 如何使用 iPhone UIView 的默认背景图片?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2487238/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 19:13:01  来源:igfitidea点击:

How to use the default background image for iPhone UIView?

iphoneobjective-cxcodeuiview

提问by RexOnRoids

How can I use the default background imagefor a UIView?

如何为 UIView使用默认背景图像

回答by kennytm

theView.backgroundColor = [UIColor groupTableViewBackgroundColor];

回答by Pablo Santa Cruz

You can do something like this with UIViewclass:

你可以用UIView类做这样的事情:

[yourview setBackgroundColor:
  [[UIColor alloc] 
     initWithPatternImage:[UIImage imageNamed:@"yourpattern.png"]]];

I always prefer using Interface Builder and just put a UIImageView occupying all UIView and send that UIImageView to back though...

我总是更喜欢使用 Interface Builder 并只放置一个 UIImageView 占据所有 UIView 并将该 UIImageView 发送回虽然...

回答by xfze

if you are using Interface Builder you can choose "Group Table View Background Color" in the inspector of your UIview.

如果您使用的是 Interface Builder,您可以在 UIview 的检查器中选择“Group Table View Background Color”。

i just found out this when I read the above answer to your problem (i was trying to do that exatly :P)

当我阅读上述问题的答案时,我才发现这一点(我正试图做到这一点:P)