从Cell的视图推出一个新的界面
生活随笔
收集整理的这篇文章主要介绍了
从Cell的视图推出一个新的界面
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
先写一个方法, 强制增加一个navigation的属性. 这样self就可以调出来navigation了
- (UINavigationController*)naviController {for (UIView* next = [self superview]; next; next = next.superview) {UIResponder* nextResponder = [next nextResponder];if ([nextResponder isKindOfClass:[UINavigationController class]]) {return (UINavigationController*)nextResponder;}}return nil; }然后, 在cell的点击方法中调用这个属性, 并推出一个新的界面:
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {myViewController *vc = [[myViewController alloc]init];[[self naviController] presentViewController:vc animated:YES completion:nil];}
总结
以上是生活随笔为你收集整理的从Cell的视图推出一个新的界面的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 【转】窗口之间的主从关系与Z-Order
- 下一篇: js注册读秒进度条