【发布时间】:2015-04-09 14:26:17
【问题描述】:
当用户触摸 tableview 行时,我使用 NMPopUpView 显示弹出窗口。 当我滚动 tableview 并触摸一行时,问题就出现了,弹出窗口出现在 tableview 的顶部。
当用户使用以下代码触摸行时,我通过跳转到 tableview 的顶部解决了这个问题:
[self.tableView setContentOffset:CGPointZero animated:NO];
然后当用户关闭弹出窗口时,我滚动到初始点:
[self.tableView scrollToRowAtIndexPath:indexPath
atScrollPosition:UITableViewScrollPositionTop
animated:YES];
但这并不是绝对专业的解决方案。
这是我用来调用弹出窗口的代码:
self.popViewController = [[PopUpViewController alloc] initWithNibName:@"PopUpViewController" bundle:nil];
[self.popViewController setTitle:@"This is a popup view"];
[self.popViewController showInView:self.tableView withImage:image withMessage:bg animated:YES];
谢谢。
解决方案:
获得滚动的位置视图:
[self.popViewController showInView:self.navigationController.view withImage:image withMessage:bg animated:YES];
【问题讨论】:
-
如果使用 UITableViewCell 的视图来显示弹窗会发生什么?
-
很遗憾没有
标签: ios objective-c uitableview popup