【发布时间】:2010-09-15 16:44:13
【问题描述】:
所以我一直在到处寻找解决这个问题的方法。我有一个表格视图,当用户选择它时,它会从单元格中显示一个弹出框。但是有一个错误,但我无法找到解决方案。基本上,一旦您从结果的第一页向下滚动,弹出框总是从屏幕底部出现,而不是从选定的表格单元格中出现。这样做的原因是我通过以下方式从单元格矩形创建弹出框:
CGRect cellRect = [tableView rectForRowAtIndexPath:indexPath];
self.detailController.contentSizeForViewInPopover = CGSizeMake(cellRect.size.width, 350);
self.personDetailPopoverController = [[[UIPopoverController alloc] initWithContentViewController:self.detailController] autorelease];
[self.personDetailPopoverController presentPopoverFromRect:cellRect
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
这适用于前 8 行(我的单元格高 100 个单位),但会导致上面提到的问题,因为它试图在 y=1400 处显示它(对于第 14 个单元格等)。有谁知道从所选单元格显示弹出框的更好方法?也许是对触摸的创造性使用?任何反馈将不胜感激。谢谢!
【问题讨论】:
标签: iphone xcode ipad uitableview ios4