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

    } error:NULL];
}

@end
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容