[英]Presenting a semi-transparent UITableView from a UIViewController
[英]Presenting a semi-transparent modal view from __block typeof(self) blockSelf
我為嘗試使此功能在iOS 7上工作而感到沮喪,但在iOS 8上卻可以正常使用。
我有一個從父vc呈現的透明模式視圖,該視圖是導航視圖控制器層次結構的一部分。 模態視圖會按預期動畫到位,但隨后的父視圖消失。
模態視圖完成工作后,將其關閉,然后返回到呈現視圖控制器。 但是我希望在屏幕上顯示模態視圖時將呈現的vc保留在原位。
我嘗試了SO的幾乎所有建議,例如設置演示vc的模式演示樣式,設置define上下文等,但是沒有一種解決方案對我有用。
為什么在iOS 8中如此簡單而在iOS 7中如此困難?
__block typeof(self) blockSelf = self;
void (^completionBlock)(POJSONResponse *obj, NSError *err) = ^(POJSONResponse *obj, NSError *error) {
if (error == nil) {
// display a transparent modal view
UINavigationController *navController = blockSelf.navigationController;
ModalViewController *mvc = [[ModalViewController alloc] init];
[mvc setModalPresentationStyle:UIModalPresentationOverCurrentContext];
navController.modalPresentationStyle = UIModalPresentationCurrentContext;
[navController presentViewController:mvc animated:YES completion:nil];
這在iOS 7中是如此困難,因為UIModalPresentationOverCurrentContext
是iOS 8中的新增功能。如果您想在iOS 7中獲得這種效果,則需要您自己做。
請參閱如何在iOS中呈現半透明(半切)視圖控制器? ,尤其是顯示如何將UIModalPresentationCustom
與自定義SemiModalAnimatedTransition
UIModalPresentationCustom
使用的SemiModalAnimatedTransition
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.