简体   繁体   English

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

[英]How to use the default background image for iPhone UIView?

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

theView.backgroundColor = [UIColor groupTableViewBackgroundColor];

You can do something like this with UIView class: 您可以使用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发送回去...

if you are using Interface Builder you can choose "Group Table View Background Color" in the inspector of your UIview. 如果使用Interface Builder,则可以在UIview的检查器中选择“组表视图背景色”。

i just found out this when I read the above answer to your problem (i was trying to do that exatly :P) 当我阅读以上对您问题的回答时,我才发现了这一点(我正试图做到这一点:P)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM