iOS13 presentViewController样式问题统一处理

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 info,UIViewController *presentViewController, BOOL animated, id completion){
        
        presentViewController.modalPresentationStyle = 0;

    } error:NULL];
}

@end

你可能感兴趣的:(iOS13 presentViewController样式问题统一处理)