从Cell的视图推出一个新的界面
生活随笔
收集整理的這篇文章主要介紹了
从Cell的视图推出一个新的界面
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
先寫一個方法, 強(qiáng)制增加一個navigation的屬性. 這樣self就可以調(diào)出來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的點擊方法中調(diào)用這個屬性, 并推出一個新的界面:
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {myViewController *vc = [[myViewController alloc]init];[[self naviController] presentViewController:vc animated:YES completion:nil];}?
總結(jié)
以上是生活随笔為你收集整理的从Cell的视图推出一个新的界面的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【转】窗口之间的主从关系与Z-Order
- 下一篇: Android PorterDuff.M