简体   繁体   English

无法更改UITableViewController颜色背景

[英]Unable to change UITableViewController color background

TitlesViewController : UITableViewController TitlesViewController:UITableViewController

I have the above code on iPhone development. 我在iPhone开发中拥有以上代码。 This is associated to a xib (or nib) file. 这与xib(或nib)文件相关联。 In this property file I change its background color. 在此属性文件中,我更改其背景颜色。 The problem is it does not reflect my new background color. 问题是它不能反映我的新背景色。 Should I be manually loading the xib file to reflect it to my TitlesViewController? 我应该手动加载xib文件以将其反映到TitlesViewController吗?

viewcontroller.view.backgroundColor =颜色;

Some quick points: 一些要点:

You don't change the colour of a view controller, you change the colour of a view controller's view. 您无需更改视图控制器的颜色,而可以更改视图控制器的视图的颜色。

A xib is an XML file that tells Xcode how to create a matching nib. xib是一个XML文件,告诉Xcode如何创建匹配的笔尖。 Neither are property files (you are likely mixing them up with plist files). 属性文件也不是(您可能会将它们与plist文件混合在一起)。

You should be able to set the background colour for just about any UIView (or subclass thereof) in your xib file. 您应该能够为xib文件中的几乎所有UIView(或其子类)设置背景颜色。 So the question is, how were you setting it the colour, what were you expecting to happen, and what did you get? 所以问题是,您如何设置颜色,您期望发生什么以及得到了什么?

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

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