當(dāng)前位置:
首頁(yè) >
从Cell的视图推出一个新的界面
發(fā)布時(shí)間:2025/3/20
26
豆豆
生活随笔
收集整理的這篇文章主要介紹了
从Cell的视图推出一个新的界面
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
先寫(xiě)一個(gè)方法, 強(qiáng)制增加一個(gè)navigation的屬性. 這樣self就可以調(diào)出來(lái)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ǎn)擊方法中調(diào)用這個(gè)屬性, 并推出一個(gè)新的界面:
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {myViewController *vc = [[myViewController alloc]init];[[self naviController] presentViewController:vc animated:YES completion:nil];}?
總結(jié)
以上是生活随笔為你收集整理的从Cell的视图推出一个新的界面的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 【转】窗口之间的主从关系与Z-Order
- 下一篇: js注册读秒进度条