Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-21-2010, 04:20 PM   #1 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 6
Default Setting Background Image of UITableViewController

Hi All

I have a grouped style UITableViewController which I am managing in code.

I have created a method to set the background of the UITableViewController which creates an image view, adds it and then sends it to the back.

The only place i can get it to work correctly is by invoking the method in
Code:
viewDidAppear
for the UITableViewController. Everything looks spot on, background image with controls on top (contained in cells with transparent backgrounds). The only problem is that the image isn't visible immediately on load of the view, you see the view first with default background and then the image applied.

I've tried invoking in
Code:
viewDidLoad
and
Code:
viewWillAppear
but the cells containing controls are not visible, all i can see is the image.

Here's the method:

Code:
- (void)setBackgroundImage {
        self.view.backgroundColor = [UIColor clearColor];

        UIImage *backgroundImage = [UIImage imageWithContentsOfFile:
[[NSBundle mainBundle]
                                                        pathForResource:@"logo320x460"
                                                        ofType:@"png"]];

        UIImageView *backgroundView = [[UIImageView alloc]
initWithImage:backgroundImage];

        backgroundView.frame = CGRectMake(0, 0, 320, 460);

        [self.view addSubview:backgroundView];
        [self.view sendSubviewToBack:backgroundView];

        [backgroundView release];

}
Is there a more appropriate place to call my setBackgroundImage method? Or a better solution than this?

Thank you in advance

Hanks
Hanks2000 is offline   Reply With Quote
Reply

Bookmarks

Tags
background, image, uitableviewcontroller

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 240
14 members and 226 guests
ADY, AragornSG, Dani77, Dattee, Duncan C, HDshot, HemiMG, Promo Dispenser, Punkjumper, Rudy, sacha1996, sneaky, spiderguy84, theone8one
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,231
Posts: 380,768
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:17 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0