Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tableview backgroundColor #4

Closed
gudeidea opened this issue Jul 29, 2013 · 7 comments
Closed

Tableview backgroundColor #4

gudeidea opened this issue Jul 29, 2013 · 7 comments

Comments

@gudeidea
Copy link

Hello,

I'm having a issue when I have only 1 result on tableview. Since I have only one cell, under it is possible to see the map.
I cannot set background color to the tableview because will cover the map.
Is there any way to workaround this?

Thanks!

@cconstable
Copy link
Owner

I think we have a couple of options:

  1. Move the map on top of the table view. This will cause the map to redraw it's labels when it's resized so I don't think this is a good solution.
  2. Make a special case for small tables that fixes the height of map view or disables scrolling. This also doesn't sound ideal.
  3. I think the best solution would be to create an intermediate UIView that starts out the top of the first cell and goes all the way to bottom of the page to obscure the map view. This view would need to grow / shrink as the page is scrolled. This solution would also allow cells to be transparent. It would act as a background view for the table view.

I'll try to get that added this week but if you want to take a stab at it feel free :)

@ripplearc
Copy link

The way I do it is to set background color for each uitableviewcell,
although I know it is quite inefficient.

On Mon, Jul 29, 2013 at 10:24 AM, Christopher Constable <
notifications@github.com> wrote:

Hmmm, that's a good question. There's a couple solutions I can see right
off the bat but they all have side-effects:


Reply to this email directly or view it on GitHubhttps://github.com//issues/4#issuecomment-21723160
.


Suyang Dong

Augment and Personalize People's Perception About the World.
I am able to do all things in him who empowers me.
I will persist until I succeed.

Entrepreneur
Ph.D. in Civil & Environment Engineering
Master of Science in Computer Science & Engineering
The University of Michigan

@cconstable
Copy link
Owner

Even setting the cells background color will not produce good results though if you only have two cells:

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    cell.contentView.backgroundColor = [UIColor yellowColor];
}

locationview

@gudeidea
Copy link
Author

Setting the background color for each uitableviewcell will not work when the table gives 1 result.
I think the best solution will be inserting an uiview between mapView an tableView and swap depth when expandMapView is called.

@cconstable
Copy link
Owner

I haven't given it much thought yet but so far that's the solution I like best. It's not the most efficient but neither is parallax scrolling to begin with :) I think preserving looks and aesthetics should be a priority here.

@charliefancelli
Copy link

Hi,

I had the same issue so i just finish to add this fixtures. It's work fine and preserve the looks and aesthetics.

In the .h file juste add :

 /** The view to the tableview background view. */
@property (nonatomic, strong) UIView *backgroundView;

/** The color of the backgroundView */
@property (nonatomic, strong) UIColor *backgroundViewColor;

In your .m in the - (void)initialize function

self.backgroundViewColor = [UIColor clearColor];

And finally at the bottom of the - (void)layoutSubviews function

if (!self.backgroundView) {
        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0.0, self.defaultMapHeight,
                                                                self.tableView.frame.size.width,
                                                                self.tableView.frame.size.height - self.defaultMapHeight)];
        view.backgroundColor = self.backgroundViewColor;
        self.backgroundView = view;
        [self.tableView insertSubview:self.backgroundView atIndex:0];
    }

You should have what you expect.

@gudeidea
Copy link
Author

gudeidea commented Oct 4, 2013

@charliefancelli Thank you so much! Now it's working fine now

Now, I'm facing some bugs on iOS 7, but only on layout stuff.

@gudeidea gudeidea closed this as completed Oct 4, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants