Warrior
Warrior

Reputation: 39384

How to set table background transparent in iphone?

I am new to iphone development .I have displayed a list of contents in a grouped table view.How can set the table background transparent such as i should see the text displayed on the gray-color(default color) background and not on the white color.Please help me out.Thanks.

Upvotes: 2

Views: 8709

Answers (6)

Bhavesh Patel
Bhavesh Patel

Reputation: 596

cell.backgroundColor = [UIColor clearColor];
cell.backgroundView = nil;
table.backgroundView = nil;

This works for me.

Upvotes: 1

B.Kosmowski
B.Kosmowski

Reputation: 143

self.view.layer.backgroundColor = [UIColor clearColor].CGColor;

Works on iOS 9.

Upvotes: 0

karim
karim

Reputation: 15599

In iOS 6 seems this is not enough. I have to set both,

menuTable.backgroundColor = [UIColor clearColor];
if ([menuTable respondsToSelector:@selector(setBackgroundView:)]) { // only after 3.2
    [menuTable setBackgroundView:nil];
}

Upvotes: 0

Warrior
Warrior

Reputation: 39384

cell.backgroundColor=[UIColor clearColor]

This worked fine for me.

Upvotes: 11

Marco
Marco

Reputation: 779

table.backgroundColor = [UIColor clearColor]

Marco

Upvotes: 3

willcodejavaforfood
willcodejavaforfood

Reputation: 44103

UITableView inherits a 'alpha' property from UIView so try changing that :)

Upvotes: -3

Related Questions