0

I need to make my grouped UITableView backgroundColor transparent.

So i write following code. That is work in iOS 6. But in iOS 5, it doesn't work.

self.tbView.backgroundView = nil;

How to do that in iOS 5.

Fire Fist
  • 7,032
  • 12
  • 63
  • 109

3 Answers3

2

Are you setting [self.tbView setBackgroundColor:[UIColor clearColor]];?

If not, you need to add that or you won't get a transparent backgorund color.

Jsdodgers
  • 5,253
  • 2
  • 20
  • 36
1

You Need to put background Nil code into ViewDidLoad this is working fine in my Code. Hope this Helps you.

    [tbl_My_Table setBackgroundView:nil];
    [tbl_My_Table setBackgroundView:[[[UIView alloc] init] autorelease]];
Nitin Gohel
  • 49,482
  • 17
  • 105
  • 144
  • yes i set background to nil in ViewDidLoad. But doesn't work in iOS 5. – Fire Fist Aug 13 '13 at 04:59
  • add One more line tbl_My_Table.opaque = NO; before [tbl_My_Table setBackgroundView:nil]; also check this:-http://stackoverflow.com/questions/4785659/uitableview-background-color-does-not-change clear your Project Build and remove project from simulator or device. run again and check it – Nitin Gohel Aug 13 '13 at 05:03
  • i think you did Mistake some other place check xib table IBOutlate – Nitin Gohel Aug 13 '13 at 05:07
  • 1
    i got it bro.I need to set both lines of following codes. Thanks you for your help bro. self.tblPreferences.backgroundView = nil; self.myTable.backgroundColor = [UIColor clearColor]; – Fire Fist Aug 13 '13 at 05:09
1

I got it answer. We need to add two lines of codes for both iOS 6 and iOS 5.

Here is codes.

self.tblPreferences.backgroundView = nil;
self.myTable.backgroundColor = [UIColor clearColor];

That is working both iOS 5 and 6.

Fire Fist
  • 7,032
  • 12
  • 63
  • 109