Search code examples
uitableviewtransparencyios7xcode5

The background colour of a grouped UITableView will not go transparent in iOS7


I am working on an app, which worked perfectly fine with iOS 6. With iOS7 the app has couple of layout and general few appearance issues. One is not being able to set the background color of a grouped tableview to transparent. Heres is my code which does not work anymore

    tableForDetails = [[UITableView alloc]initWithFrame:CGRectMake(0, yAxisTable, 320, 150) style:UITableViewStyleGrouped];
    UIColor *backGroundColor = [UIColor clearColor];
    UIView *bview = [[UIView alloc]init];
    [bview setBackgroundColor:backGroundColor];
    [tableForDetails setBackgroundView:bview];

Help is greatly appreciated. Thanks


Solution

  • To set background transparency for a grouped uiTableview in iOS7 is really quite easy. The solution is even more simple than I originally thought.

    [tableForDetails setBackgroundColor:[UIColor clearColor]];
    

    or for only semi transparent

    [tableForDetails setBackgroundColor:[[UIColor alloc]initWithRed:1.0 green:1.0 blue:1.0 alpha:0.5]];
    

    This worked fine for me.