Mil0R3
Mil0R3

Reputation: 3956

display the view behind tableView (or scrollView)

For example: there is a tableView, when it is pulled down, the back view display. the effect is like this:

enter image description here

I tried like this but not working:

[self.view addSubview:logoView];
[self.view addSubview:tableView];

Upvotes: 1

Views: 380

Answers (4)

TamilKing
TamilKing

Reputation: 1643

You set the tableView background as your logoview. Keep your UITableviewCell as what color you want.

Upvotes: 1

steharro
steharro

Reputation: 1079

You can achieve the same as the example image above by adding the view with a negative y offset.

UIView *header = [[UIView alloc] initWithFrame: CGRectMake(0.0f, 0.0f - self.view.bounds.size.height, self.view.bounds.size.width, self.view.bounds.size.height)];
header.backgroundColor = [UIColor lightGrayColor];
[self.tableView addSubview:header];

However if you have content in this view, such as a logo, it will appear to be pulled down from the top, rather than behind the table, I don't know if this is the effect you want or not.

Upvotes: 0

amar
amar

Reputation: 4345

You have to

  1. add your logo image view below the table view in xib.
  2. set table view background color to clear color
  3. Set logo image hidden.
  4. in - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate or check for your self which delegate is best suited. set the logo image hidden to NO

Upvotes: 1

nickAtStack
nickAtStack

Reputation: 163

I'm not sure if i recognize your problem but i think you want something like this:

you'll have to use:

[self.view insertSubview:aboveSubview: ];
[self.view  insertSubview:belowSubview: ];

not [self.view addSubview: ];

Upvotes: 0

Related Questions