美文网首页
iOS13 presentViewController样式问题统

iOS13 presentViewController样式问题统

作者: 小苏羿 | 来源:发表于2019-10-26 10:45 被阅读0次
iOS13的到来,各种坑爹的交互强行出现,今天说的是presentViewController的时候新添加的modal --- UIModalPresentationAutomatic。iOS13默认present的VC就是这鬼模式。

改回原来的不可能去一个个的添加presentViewController.modalPresentationStyle = 0;

直接利用runtime神器,Aspects库,一次性转换

#import "UIViewController+presentViewControllerAction.h"

#import "Aspects.h"

@implementation UIViewController (presentViewControllerAction)

+(void)load
{
    
    [UIViewController aspect_hookSelector:@selector(presentViewController:animated:completion:) withOptions:AspectPositionBefore usingBlock:^(id<AspectInfo> info,UIViewController *presentViewController, BOOL animated, id completion){
        
        presentViewController.modalPresentationStyle = 0;

    } error:NULL];
}

@end

相关文章

网友评论

      本文标题:iOS13 presentViewController样式问题统

      本文链接:https://www.haomeiwen.com/subject/kpyyvctx.html