1

I would like to let display gladly in my RootView a UIImage above the table. How can I make that?

NoX
  • 11
  • 1
  • What do you mean by "above"? Do you want the image to be placed at the beginning of the table view or directly on top of it? – hennes Mar 09 '11 at 16:30

1 Answers1

0

You should use the setBackgroundView method.

A little example:

// my image
UIImage *image = [[[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"my_image" ofType:@"png"]] autorelease];

// an imageView to put the imagen on
UIImageView *imageView = [[[UIImageView alloc] initWithImage:image] autorelease];

// we set the background of the table with the imageView    
[myTable setBackgroundView:imageView];
Rafael Afonso
  • 301
  • 2
  • 7
  • There is no real need for the autorelease or is there? The backgroundView property is defined with the retain keyword, so you can savely release the image and the image view after calling setBackgroundView. – hennes Mar 09 '11 at 16:28
  • Exactly, the autorelease is not necessary. It's just one (of my many) habits. Sorry if it confuses you from the main purpose of the code. – Rafael Afonso Mar 09 '11 at 16:33