is groupTableViewBackgroundColor deprecated on iOS 6?

后端 未结 9 1436
-上瘾入骨i
-上瘾入骨i 2020-11-28 09:56

I was just testing my app with iOS 6.0 and Xcode 4.5GM and I have set up a view like this:

[self.view setBackgroundColor:[UIColor groupTableViewBackgroundCol         


        
9条回答
  •  天涯浪人
    2020-11-28 10:25

    It's good idea to use standard methods for previous iOs versions. So I improved solution of James Boutcher:

    + (void)setBackgroundColorForTableView:(UITableView*) tableView
    {
        UIColor* color = [UIColor whiteColor];
        NSString* version = [[UIDevice currentDevice] systemVersion];
        if([version floatValue] < 6.0)
        {
            tableView.backgroundColor = color;
        }
        else
        {
            tableView.backgroundView = nil;
            UIView* bv = [[UIView alloc] init];
            bv.backgroundColor = color;
            tableView.backgroundView = bv;
            [bv release];
        }
    }
    

提交回复
热议问题