iOS中模態(tài)Model視圖跳轉(zhuǎn)和Push視圖跳轉(zhuǎn)的需求實(shí)現(xiàn)方法
本文給大家分享下模態(tài)Model視圖跳轉(zhuǎn)和Push視圖跳轉(zhuǎn)的需求實(shí)現(xiàn)。
開前自打小廣告:一鍵合成APP引導(dǎo)頁,包含不同狀態(tài)下的引導(dǎo)頁操作方式,同時(shí)支持動(dòng)態(tài)圖片引導(dǎo)頁和靜態(tài)圖片引導(dǎo)頁以及視頻引導(dǎo)頁;GitHub地址: https://github.com/dingding3w/DHGuidePageHUD (多多Star,多多支持😊);
(一)連續(xù)兩次模態(tài)Model視圖之后,然后返回首頁(A -> B -> C -> A)
?、傩Ч麍D展示:
②核心代碼展示:
/** 在C頁面的DisMiss方法里面添加一下代碼(iOS6.0+) */ if ([self respondsToSelector:@selector(presentingViewController)]){ [self.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:nil]; } else { [self.parentViewController.parentViewController dismissViewControllerAnimated:YES completion:nil]; }
(二)在模態(tài)Model推出的視圖中Push下一個(gè)帶導(dǎo)航欄的視圖,然后返回首頁(A -> B ->C -> A)
?、傩Ч麍D展示:
?、诤诵拇a展示:
/** 這里用到的核心處理辦法是 */ /** 1.在A控制器模態(tài)Model推出B控制器的時(shí)候先給B控制器包裝一個(gè)導(dǎo)航控制器 */ UINavigationController *ANavigationController = [[UINavigationController alloc] initWithRootViewController:[[BViewController alloc] init]]; [self presentViewController:ANavigationController animated:YES completion:nil]; /** 2.在B控制器遵守UINavigationControllerDelegate實(shí)現(xiàn)代理協(xié)議,隱藏當(dāng)前控制器的導(dǎo)航欄 */ #pragma mark - UINavigationControllerDelegate - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { // 判斷要顯示的控制器是否是自身控制器 BOOL isShowMyController = [viewController isKindOfClass:[self class]]; [self.navigationController setNavigationBarHidden:isShowMyController animated:YES]; } #pragma mark - Push出C控制器 [self.navigationController pushViewController:[[CViewController alloc] init] animated:YES]; /** 3.在C控制器里面可直接在返回按鈕方法里DisMiss */ [self.navigationController dismissViewControllerAnimated:YES completion:nil];
以上所述是小編給大家介紹的iOS中模態(tài)Model視圖跳轉(zhuǎn)和Push視圖跳轉(zhuǎn)的需求實(shí)現(xiàn)方法,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
相關(guān)文章
IOS 開發(fā)之xcode對(duì)比兩個(gè)分支中同一個(gè)文件
這篇文章主要介紹了IOS 開發(fā)之xcode對(duì)比兩個(gè)分支中同一個(gè)文件的相關(guān)資料,希望通過本文能幫助到大家實(shí)現(xiàn)這樣的功能,需要的朋友可以參考下2017-08-08iOS使用fastlane實(shí)現(xiàn)持續(xù)集成的方法教程
這篇文章主要給大家介紹了關(guān)于iOS使用fastlane如何實(shí)現(xiàn)持續(xù)集成的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對(duì)各位iOS開發(fā)者們具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧2019-04-04ios獲取數(shù)據(jù)之encodeURI和decodeURI的實(shí)例
下面小編就為大家?guī)硪黄猧os獲取數(shù)據(jù)之encodeURI和decodeURI的實(shí)例。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-11-11