iOS 由cell获取到controller

在上看到了一个很牛逼的方法,记录下来,不用响应链两行搞定;

    UICollectionView *collection = (UICollectionView *) self.superview;
    
    UIViewController *vc = (UIViewController *) collection.dataSource;
    [vc presentViewController:alertController animated:YES completion:nil];

你可能感兴趣的:(iOS 由cell获取到controller)