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

  • SEARCH
  • Home
  • 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 9162787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:17:44+00:00 2026-06-17T14:17:44+00:00

Stuck on something and i’m not sure if it’s even possible. Is there a

  • 0

Stuck on something and i’m not sure if it’s even possible. Is there a way to set the background of a UITableView as a custom image, but NOT let that background apply to the tableHeaderView. I have a header on my table that needs to remain transparent, because I have a parallax type effect (like the path 2 app) implemented with an image behind the transparent table header & the top 1/3rd of the tableview… but i need to get a custom image behind the rest of the table.

I can successfully get close to the background style im looking for that fills in behind each cell, with:

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath

However, this is not quite what Im looking for because I would like a radial gradient background view behind the entire tableview on the screen, minus the transparent header… not just the same image for each cell. Also, this approach really hits my tableview’s scrolling performance loading a new BG image with each cell.

I know you can use:

  UIImageView *tempImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image.png"]];
  [tempImageView setFrame:self.tableView.frame];

  self.tableView.backgroundView = tempImageView;

to set the BG image for the tableview, and it is really close to what I’m trying to do, but I neeeeeed that header transparent. Is there any way to use this, but also tell the tableHeaderView to ignore it and be transparent?
Thanks everyone, & happy Halloween!

  • 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-06-17T14:17:45+00:00Added an answer on June 17, 2026 at 2:17 pm

    Yes, you can. I implemented a solution for the parallax effect for a grouped UITableView. You could use the same approach except instead of a black background (example below) you could use your image. Essentially, you have two views behind the tableview (which is clear, header view background clear as well as the table view background itself). These two views you move based on scrolling (UIScrollViewDelegate). Your tableview background image you’ll “scroll” 1 for 1 with the table, while your parallax image will “scroll” at a different rate of course. In the below example i think my “_secondParaView” would be your background image for the table.

    Firstly, in viewDidLoad, create a view to partially hide your image for the parallax effect, should be the same color as the background you want the tableview to be, in my case blackColor. I placed the view at a fixed offset based on the size of my image, you want the top of this view to line up with the top of the end of ‘section 0’ header view. It will then “scroll” just as the tableview scrolls. Insert this view below the tableview.

    _secondParaView = [[UIView alloc] initWithFrame: CGRectMake(0.0, kTableViewOffset, self.view.frame.size.width, 200.0)];
    _secondParaView.backgroundColor = [UIColor colorWithRed: 0.0 green: 0.0 blue: 0.0 alpha: 1.0];
    [self.view insertSubview: _secondParaView belowSubview: _tableView];
    
    _headerImageYOffset = -40.0;
    _headerImageView = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @"SpaceRedPlanet640x480.png"]];
    CGRect headerImageFrame = _headerImageView.frame;
    headerImageFrame.origin.y = _headerImageYOffset;
    _headerImageView.frame = headerImageFrame;
    [self.view insertSubview: _headerImageView belowSubview: _secondParaView];
    _tableView.backgroundColor = [UIColor clearColor];
    

    Then implement the two grouped tableview methods for the header view / header view size:

    - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
        if (section == 0) {
            UIView * tableHeaderView = [[UIView alloc] initWithFrame: CGRectMake(0.0, 0.0, self.view.frame.size.width, kTableViewOffset)];
            tableHeaderView.backgroundColor = [UIColor clearColor];     
            return tableHeaderView;
        } else
            return nil;
    }
    
    - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
        if (section == 0) {
            return kTableViewOffset;
        } else 
            return 2;
    }
    

    Just like in the “normal” tableview parallax implementation, make your VC a UIScrollViewDelegate and implement this scrollViewDidScroll like so:

    #pragma mark -
    #pragma mark UIScrollViewDelegate methods
    - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
        CGFloat scrollOffset = scrollView.contentOffset.y;
        CGRect headerImageFrame = _headerImageView.frame;
        CGRect underParaFrame = _secondParaView.frame;
    
        if (scrollOffset < 0) {
            // Adjust top image proportionally
            headerImageFrame.origin.y = _headerImageYOffset - ((scrollOffset / 3));
        } else {
            // We're scrolling up, return to normal behavior
            headerImageFrame.origin.y = _headerImageYOffset - scrollOffset;
        }
        underParaFrame.origin.y = kTableViewOffset - scrollOffset;
        _headerImageView.frame = headerImageFrame;
        _secondParaView.frame = underParaFrame;
    }
    

    Hope this helps, or at the very least helps someone implement the parallax effect for a grouped tableview. I could find no solution for it.

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

Sidebar

Related Questions

I am stuck with something quite simple but really annoying: I have an xml
I'm trying to pick up Lua programming but I'm stuck on something that's probably
I think I have a basic understanding of REST, but something I'm stuck on
Im trying to make something like an Rpg game atm but im really stuck
I'm stuck at something that seemed easy but became a headache pretty fast: Here
I am stuck on something that seems very simple but I must be missing
I am new to php, just got stuck with something could be even simple...
I'm starting to play with arrays, but i'm stuck with something that seems yet
I am getting the hang of 2.0, but a bit stuck on something that
I'm stuck with something which is probably quite simple to resolve but don't have

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.