【问题标题】:UICollectionView Segue not showing detail VCUICollectionView Segue 不显示细节 VC
【发布时间】:2014-11-06 13:58:21
【问题描述】:

我有 2 个视图控制器 - 一个带有 collectionView 显示图像,另一个是相应的详细视图 - 非常基本。问题是由于某种原因无法选择 collectionView 中的项目(触摸但没有任何反应)。另外,我没有使用导航控制器将 collectionView VC 嵌入其中,而是更喜欢使用带有自定义按钮的 unwind segue - 这可行吗?

我建立了从 collectionView Cell 到 Detail VC 的连接。

在prepareForSegue中

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([segue.identifier isEqualToString:@"detailSegue"]) {
        LPDiaryDetailViewController *destViewController = segue.destinationViewController;
        NSIndexPath *indexPath = [self.collectionView indexPathForCell:sender];
        LocationImage *image = self.savedItems[indexPath.row];
        destViewController.captionString = image.caption;
    }
}

【问题讨论】:

    标签: ios uicollectionview uistoryboardsegue


    【解决方案1】:

    单元格可能没有响应触摸,因为您尚未将图像视图的 userInteractionEnabled 属性设置为 YES(默认为 NO)。

    你不能使用 unwind segue 继续前进;它们用于返回到以前的控制器,因此您使用 unwind segue 的偏好没有意义。您的意思是使用 unwind segue 从细节 VC 中返回?目前尚不清楚您想要此自定义按钮的位置。您已经从单元格连接了 segue,因此您不需要按钮来调用 segue。

    【讨论】:

    • 在细节上回去放松一下
    • @noobsmcgoobs 展开将撤消您使用的任何前向 segue。因此,如果您继续进行模态演示,那么 unwind 将执行解雇 - 如果您愿意,可以这样做。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-14
    • 2017-03-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多