【发布时间】:2013-09-26 08:04:30
【问题描述】:
对我来说这看起来很简单,但我无法理解我犯了什么错误。我必须在我的 iPad 应用程序中单击行时打开一个弹出窗口。我已经完成了以下代码:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
popViewController *vc = [[popViewController alloc] initWithNibName:@"popViewController" bundle:nil];
vc.preferredContentSize = CGSizeMake(500,500);
vc.view.frame = CGRectMake(0, 0, 500, 500);
UIPopoverController *healthPopOver = [[UIPopoverController alloc] initWithContentViewController:vc];
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
[healthPopOver presentPopoverFromRect:cell.bounds inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
应用程序在执行最后一行时崩溃。我在网上搜索了很多页面,但我无法找到它的原因。我没有收到任何特定错误,只有主文件中的线程 1 错误。
我使用的是 iOS 7。
【问题讨论】:
-
问题在于没有保留弹出框。按照@null 的建议保留弹出框。
标签: iphone ios ipad uipopovercontroller