1234567891011121314151617181920212223242526272829 |
- //
- // UIViewController+PresentationStyle.m
- // xike
- //
- // Created by 翟玉磊 on 2017/9/29.
- // Copyright © 2017年 翟玉磊. All rights reserved.
- //
- #import "UIViewController+PresentationStyle.h"
- @implementation UIViewController (PresentationStyle)
- + (void)load {
- Method originAddObserverMethod = class_getInstanceMethod(self, @selector(presentViewController:animated:completion:));
- Method swizzledAddObserverMethod = class_getInstanceMethod(self, @selector(xike_presentViewController:animated:completion:));
- method_exchangeImplementations(originAddObserverMethod, swizzledAddObserverMethod);
- }
- - (void)xike_presentViewController:(UIViewController *)viewControllerToPresent animated:(BOOL)flag completion:(void (^)(void))completion {
- if (@available(iOS 13.0, *)) {
- viewControllerToPresent.modalPresentationStyle = UIModalPresentationFullScreen;
- [self xike_presentViewController:viewControllerToPresent animated:flag completion:completion];
- } else {
- [self xike_presentViewController:viewControllerToPresent animated:flag completion:completion];
- }
- }
- @end
|