开发者

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

开发者 https://www.devze.com 2023-03-15 03:59 出处:网络
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 appear开发者_如何学JAVAs on the screen table should move up,So that

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 appear开发者_如何学JAVAs 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.


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.


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].

0

精彩评论

暂无评论...
验证码 换一张
取 消