一、iOS13 開始運(yùn)行應(yīng)用程序調(diào)用present方法的時(shí)候會(huì)出現(xiàn)顯示效果的變化(看起來好像挺好看的)损姜,因?yàn)樵趇OS13中modalPresentationStyle的默認(rèn)改為UIModalPresentationAutomatic,而在之前默認(rèn)是UIModalPresentationFullScreen
效果圖
二、 ** 重點(diǎn)工窍!重點(diǎn)魄鸦!重點(diǎn)!** 生命周期會(huì)發(fā)生變化茅郎,例如:page1 present page2蜗元,page2 dismiss時(shí),page1的 viewWillAppear 等相關(guān)的生命周期方法將不會(huì)執(zhí)行只洒,還有頁面高度也會(huì)不同许帐,為了避免不必要的問題產(chǎn)生,所以建議大家一定要手動(dòng)處理modalPresentationStyle設(shè)置為UIModalPresentationFullScreen
修改方式涉及兩種情況
1.無nav情況
UIViewController *viewController = [[UIViewController alloc] init];
viewController.modalPresentationStyle = UIModalPresentationFullScreen;
[self persentViewController:viewController animated:YES completion:nil];
2.有nav的情況
UIViewController *viewController = [[UIViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:viewController];
nav.modalPresentationStyle = UIModalPresentationFullScreen;
[self.navigationController presentViewController:nav animated:YES completion:nil];
躺贏源碼在此毕谴,放入工程即可* demo