Commit affefcd0 authored by huanglu's avatar huanglu

update

parent f5ef3a6f
......@@ -53,7 +53,7 @@ ImageEditorManger *imageEditorManager = nil;
data.imageURL = [NSURL URLWithString:image.origImage];
[dataSource addObject:data];
}
UIWindow *currentWindow = [Utils currentWindow];
UIView *currentWindow = [Utils getCurrentVC].view;
self.browser.dataSourceArray = dataSource;
self.browser.currentPage = model.index;
if (model.editable) {
......
......@@ -21,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (NSData *)imageData:(UIImage *)image;
+ (UIWindow *) currentWindow;
+ (UIViewController *)getCurrentVC;
+ (void) toVC:(UIViewController *)vc;
......
......@@ -73,13 +73,36 @@
return data;
}
+ (UIWindow *) currentWindow {
return [UIApplication sharedApplication].keyWindow;
//获取当前屏幕显示的viewcontroller
+ (UIViewController *)getCurrentVC {
UIViewController *result = nil;
UIWindow * window = [[UIApplication sharedApplication] keyWindow];
if (window.windowLevel != UIWindowLevelNormal)
{
NSArray *windows = [[UIApplication sharedApplication] windows];
for(UIWindow * tmpWin in windows)
{
if (tmpWin.windowLevel == UIWindowLevelNormal)
{
window = tmpWin;
break;
}
}
}
UIView *frontView = [[window subviews] objectAtIndex:0];
id nextResponder = [frontView nextResponder];
if ([nextResponder isKindOfClass:[UIViewController class]])
result = nextResponder;
else
result = window.rootViewController;
return result;
}
+ (void) toVC:(UIViewController *)vc {
UIWindow *window = [Utils currentWindow];
UIViewController *rootVC = window.rootViewController;
UIViewController *rootVC = [Utils getCurrentVC];
vc.modalPresentationStyle = UIModalPresentationCustom;
[rootVC presentViewController:vc animated:true completion:nil];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment