• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to set background color of TableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to set background color of TableView


  • Subject: Re: How to set background color of TableView
  • From: Luke Hiesterman <email@hidden>
  • Date: Thu, 13 May 2010 07:10:00 -0700

I was referring to the background view property of UITableView. 

You should be doing myTableView.backgroundView = topView. 

Luke

Sent from my iPhone.

On May 12, 2010, at 11:24 PM, Praveen Kumar <email@hidden> wrote:

sorry Luke, i did not know where to ask this question?
Okay here i am trying like this

UIView *topview = [[[UIView alloc] initWithFrame:CGRectMake(0,0,320,880)] autorelease];
    topview.backgroundColor = [UIColor colorWithRed:0.125 green:0.2 blue:0.05 alpha:1];
   
    [self.myTableView addSubview:topview];
    [self.myTableView sendSubviewToBack:topview];
   
    //self.myTableView.backgroundColor = [UIColor redColor];
    //self.myTableView.backgroundColor = [UIColor colorWithRed:0.125 green:0.2 blue:0.05 alpha:1];
    self.myTableView.backgroundColor = [UIColor clearColor];
    [self setEditingButtonsOnNavBar:FALSE];
    [super viewDidLoad];
but did not work.
Praveen

On Thu, May 13, 2010 at 3:14 AM, Luke the Hiesterman <email@hidden> wrote:
1. This isn't an xcode question
2. setting the background color to clear isn't a good idea. You should take whatever you're trying to display behind the table and set it as the tableView's backgroundView

Luke

On May 12, 2010, at 2:41 PM, Tony Romano wrote:

Maybe the the autorelease is causing the object to be freed before it's time?  Any crash issues?   Also, minor nit, you are calling setBackgroundColor on a UIView and not a UITableView, should work but clarity is important and I assume you have a copy/paste issue by omitting the closing '[]' for the autorelease.

-Tony

On May 12, 2010, at 12:26 PM, Praveen Kumar wrote:

Hi Folks,
I have tried all the way but could not succeed to set backgroundColor of TableView.
setting tableView.backgroundColor and/or cell.backgroundColor to clearColor didn't work when the parent view controller was UIViewContoller.
My nib file structure is

FileOwner
View
   UITableView
(Note: i set the TableView to groupedTable section)

First attempt, I created the UIView in the code viewDidLoad
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 160, 300)] autorelease;
[view setBackgroundColor:UIColor blueColor]; // color it just to see if it is created at the right place
[self.tableView sendSubViewToBack:view];
It works but it hides the content of cell. I am able to see the content of header but not cell content. (But when i change the co-ordinate of view(0,150,160,300) then i am able to see the cell's content but then it loose the backgroundColor of tableview.

Second attempt,
I created the imageView
View
  ImageView
  UITableView
and set the self.tableView.backgroundColor = [UIColor clearColor]; but did not work.

I googled but did not the peaceful answer.

Thanks,
Praveen
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)

This email sent to email@hidden

-Tony

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)

This email sent to email@hidden




--
Praveen Kumar
+91 9620621342
http://praveensunsetpoint.wordpress.com
Bangalore
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >How to set background color of TableView (From: Praveen Kumar <email@hidden>)
 >Re: How to set background color of TableView (From: Tony Romano <email@hidden>)
 >Re: How to set background color of TableView (From: Luke the Hiesterman <email@hidden>)
 >Re: How to set background color of TableView (From: Praveen Kumar <email@hidden>)

  • Prev by Date: Xcode 3.2.2 Linker warnings
  • Next by Date: Re: How to set background color of TableView
  • Previous by thread: Re: How to set background color of TableView
  • Next by thread: Re: How to set background color of TableView
  • Index(es):
    • Date
    • Thread