【发布时间】:2016-02-13 15:17:50
【问题描述】:
我有一个由表格视图组成的UIPopoverController。这个弹出式控制器显示得很好,我已经设置了委托didSelectRowAtIndexPath 就好了。
现在,我想根据单击的表项进行一些过渡到“详细视图控制器”。然后在目标视图上,它有类似pushViewController 的后退按钮,但效果不佳。它不会导航到详细视图控制器。这是我的didSelectRowAtIndexPath:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
DetailSummaryViewController *detailVC = [[DetailSummaryViewController alloc] initWithNibName:@"DetailSummaryViewController" bundle:nil];
[self.navigationController pushViewController:detailVC animated:YES];
}
这是我的弹出框方法
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
CalendarCell *cell = (CalendarCell *)[collectionView cellForItemAtIndexPath:indexPath];
UIPopoverController *popC = [[UIPopoverController alloc] initWithContentViewController:[SummaryViewController new]];
[popC setPopoverContentSize:CGSizeMake(320, 400)];
[self setPop:popC];
[[self pop] presentPopoverFromRect:[cell frame]
inView:collectionView
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
}
那些导航不起作用,但如果我 NSLog-ing 选择的索引它工作得很好。是否有一些设置导航的步骤我错过了?
【问题讨论】:
-
下面的答案(Raica)是解决它的方法。
标签: ios objective-c ipad uinavigationcontroller uipopovercontroller