Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 970899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:52:32+00:00 2026-05-16T02:52:32+00:00

Hey everyone, this seems like it should be a simple one; I really hope

  • 0

Hey everyone, this seems like it should be a simple one; I really hope it is. As always, thanks in advance!

All I’m trying to do is add a background image to a grouped style tableview. I’m using the following method in viewDidLoad:

self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background.png"]];

Unfortunately, background.png seems to be drawn not only behind the cells, but also on the backgrounds of the cells and the headers as follows:

alt text http://www.freeimagehosting.net/uploads/194449ffc1.png

I know there are a few questions on this site addressing similar issues, but I’m afraid I couldn’t get anything to work. How can I set the background of UITableView (the tableview style is "Grouped") to use an image? led me to add

self.tableView.opaque = NO;
self.tableView.backgroundView = nil;

to viewDidLoad and to add

cell.backgroundView = nil;
cell.opaque = NO;

in configuring my cells. Needless to say, it didn’t work. Adding

cell.backgroundColor = [UIColor clearColor];

didn’t work either. And sadly, that was my last idea. I’d really like to be able to do this without adding the background in interface builder, if possible. I rather like doing as much as I can programmatically. I hope asking that isn’t too greedy. Thanks again!

*
*
*
EDIT:
*
*
*

I came across another approach to accomplishing this, but ran into another problem. I added the following code to viewDidLoad:

    UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
    bgView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background.png"]];
    [self.tableView.window addSubview:bgView];

    [self.tableView addSubview:bgView];
    [self.tableView sendSubviewToBack:bgView];

It looked promising, and it likely is, but unfortunately in gave me the following:
alt text http://www.freeimagehosting.net/uploads/c02dd68e20.png

It looks as though it either wasn’t sent to the back and the headers somehow show through or the cells went to the back with it. I’m not at all sure. Any advice here would be appreciated as well.

Here’s where I found the code for the edit:
Add UIView behind UITableView in UITableViewController code

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T02:52:33+00:00Added an answer on May 16, 2026 at 2:52 am

    I still haven’t figured out why the above doesn’t work or how to modify it so that it does, but by adding the subView to the window in the App Delegate instead of the tableView here I was able to get it to work.

    Instead of just getting it to function and moving on I’d like to actually learn, so I’m still curious as to where I went wrong above. As such, I’ll leave this as unanswered for a time and if you can tell me my error(s) I’ll give you the up vote and the green check mark. Thanks!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey everyone, I am trying to run the following program, but am getting a
Hey everyone. I'm trying to make a swing GUI with a button and a
Hey all, my Computational Science course this semester is entirely in Java. I was
Hey all. Newbie question time. I'm trying to setup JMXQuery to connect to my
Hey everyone, I'm using Virtual PC and working with a virtual hard disk (*.vhd)
Hey everyone, I'm working on a PHP application that needs to parse a .tpl
Hey so what I want to do is snag the content for the first
Hey, I'm using Levenshteins algorithm to get distance between source and target string. also
Hey, I've been developing an application in the windows console with Java, and want
Hey peoples, I've been studying Java for a couple of weeks, and have decided

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.