iOS中模態(tài)Model視圖跳轉(zhuǎn)和Push視圖跳轉(zhuǎn)的需求實(shí)現(xiàn)方法
本文給大家分享下模態(tài)Model視圖跳轉(zhuǎn)和Push視圖跳轉(zhuǎn)的需求實(shí)現(xiàn)。
開(kāi)前自打小廣告:一鍵合成APP引導(dǎo)頁(yè),包含不同狀態(tài)下的引導(dǎo)頁(yè)操作方式,同時(shí)支持動(dòng)態(tài)圖片引導(dǎo)頁(yè)和靜態(tài)圖片引導(dǎo)頁(yè)以及視頻引導(dǎo)頁(yè);GitHub地址: https://github.com/dingding3w/DHGuidePageHUD (多多Star,多多支持😊);
(一)連續(xù)兩次模態(tài)Model視圖之后,然后返回首頁(yè)(A -> B -> C -> A)
?、傩Ч麍D展示:

②核心代碼展示:
/** 在C頁(yè)面的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)航欄的視圖,然后返回首頁(yè)(A -> B ->C -> A)
?、傩Ч麍D展示:

②核心代碼展示:
/** 這里用到的核心處理辦法是 */
/** 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ì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
相關(guān)文章
IOS與網(wǎng)頁(yè)JS交互詳解及實(shí)例
這篇文章主要介紹了 IOS與網(wǎng)頁(yè)JS交互詳解及實(shí)例的相關(guān)資料,需要的朋友可以參考下2016-12-12
詳解iOS中多倒計(jì)時(shí)場(chǎng)景的解決方案
在我們開(kāi)發(fā)APP的過(guò)程中,或多或少都遇到過(guò)需要使用倒計(jì)時(shí)的場(chǎng)景,這篇文章主要介紹了詳解iOS中多倒計(jì)時(shí)場(chǎng)景的解決方案,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-11-11
IOS 開(kāi)發(fā)之xcode對(duì)比兩個(gè)分支中同一個(gè)文件
這篇文章主要介紹了IOS 開(kāi)發(fā)之xcode對(duì)比兩個(gè)分支中同一個(gè)文件的相關(guān)資料,希望通過(guò)本文能幫助到大家實(shí)現(xiàn)這樣的功能,需要的朋友可以參考下2017-08-08
iOS使用fastlane實(shí)現(xiàn)持續(xù)集成的方法教程
這篇文章主要給大家介紹了關(guān)于iOS使用fastlane如何實(shí)現(xiàn)持續(xù)集成的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)各位iOS開(kāi)發(fā)者們具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-04-04
ios獲取數(shù)據(jù)之encodeURI和decodeURI的實(shí)例
下面小編就為大家?guī)?lái)一篇ios獲取數(shù)據(jù)之encodeURI和decodeURI的實(shí)例。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-11-11

