Reputation: 2848
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
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
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