Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
UITableView参数不是从IB继承的_Uitableview_Interface Builder_Background Color - Fatal编程技术网

UITableView参数不是从IB继承的

UITableView参数不是从IB继承的,uitableview,interface-builder,background-color,Uitableview,Interface Builder,Background Color,我有一个使用故事板在Xcode 4.2.1中构建的TabBar应用程序。问题是UITableView没有反映我在IB中所做的更改。例如:当我使用IB更改背景色、滚动条可见性、分隔符颜色时,UITableView没有可见的效果 但是,如果我以编程方式设置这些参数,它们工作得很好。我错过了什么?下面是一些代码: - (void)viewDidLoad { [super viewDidLoad]; // get a pointer to our delegate. This is w

我有一个使用故事板在Xcode 4.2.1中构建的TabBar应用程序。问题是UITableView没有反映我在IB中所做的更改。例如:当我使用IB更改背景色、滚动条可见性、分隔符颜色时,UITableView没有可见的效果

但是,如果我以编程方式设置这些参数,它们工作得很好。我错过了什么?下面是一些代码:

- (void)viewDidLoad
{
    [super viewDidLoad];

    // get a pointer to our delegate. This is where the data will be stored
    // which gets passed between the Views (e.g. Favorites)
    appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];

    myTableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame] style:UITableViewStylePlain];

    myTableView.dataSource = self;
    myTableView.delegate = self; 
//  myTableView.backgroundColor=[UIColor blackColor];

    // this will suppress the separator lines between empty rows.
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1, 1)];
    myTableView.tableFooterView = view;

    self.view = myTableView;
}

修复:上面的类扩展ViewController。我将其更改为扩展UITableViewController,一切都正常了。viewDidLoad()方法现在大大简化了,因为我手动配置的许多内容都是由UITableViewController类自动处理的。我现在可以按预期更改IB中的UITableView参数

- (void)viewDidLoad
{
    // during construction, call the super class's method FIRST. 
    [super viewDidLoad];

    // get a pointer to our delegate. This is where the data will be stored
    // which gets passed between the Views (e.g. Favorites)
    appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];

    // this will suppress the separator lines between empty rows.
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1, 1)];
    self.tableView.tableFooterView = view;
}