Monish Kumar
Monish Kumar

Reputation: 2848

How to move tableView up inorder to popUp a view from bottom So that it is not on top of table in iPhone

I have a tableView.It exists from half portion of iPhone screen to bottom.If I click any cell a popup comes up from bottom. When it appears on the screen table should move up,So that popup does not overlap on tableView.

Can anyone suggest How to do this.
Thanks in Advance.

Upvotes: 0

Views: 1536

Answers (2)

EmptyStack
EmptyStack

Reputation: 51374

Set,

CGPoint _contentOffset = CGPointMake(tableView.contentOffset.x, aNegativeYValue);
tableView.contentOffset = _contentOffset;

If you want it animated, use,

CGPoint _contentOffset = CGPointMake(tableView.contentOffset.x, aNegativeYValue);
[tableView setContentOffset:_contentOffset animated:YES];

You can also use table view's scrollToRowAtIndexPath:atScrollPosition:animated: method.

Upvotes: 4

uvesten
uvesten

Reputation: 3365

The simplest way is to embed your tableView (and your other views, since you apparently have more than one view on screen) in a UIScrollView.

Then when you present the popup window on screen, calculate an offset to scroll to by getting your popup window's size, then slide up the tableView using [scrollView setContentOffset:MyOffset animated:YES].

Upvotes: 0

Related Questions