Pages

Wednesday, April 13, 2011

[Code Snippet] Change UITableView background.

With this post we'll begin a serie of weekly code snippets which could help newbies (and not newbies at all) for its iPhone developments.

Today's snippet it's the code neccesary for changing UITableView backgroud to a custom image which will be in our Resources folder, very simple but very useful.

    [self.tableView setBackgroundColor:[UIColor clearColor]];
   
    UIImageView *background = [[UIImageView alloc] init];
    background.frame = CGRectMake(0.0f, 0.0f, 320.0f, 480.0f);
    background.image = [UIImage imageNamed:@"background-1.png"];
   
    self.tableView.backgroundView = background;

Enjoy it!

No comments:

Post a Comment