iOS13 presentViewController样式问题统

2019-10-26  本文已影响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
上一篇 下一篇

猜你喜欢

热点阅读