Commit c5696534 authored by sunzheng's avatar sunzheng
parents d455199f 8ecb4b46
......@@ -53,7 +53,7 @@ ImageEditorManger *imageEditorManager = nil;
data.imageURL = [NSURL URLWithString:image.origImage];
[dataSource addObject:data];
}
UIWindow *currentWindow = [Utils currentWindow];
UIView *rootView = [Utils getCurrentVC].view;
self.browser.dataSourceArray = dataSource;
self.browser.currentPage = model.index;
if (model.editable) {
......@@ -65,13 +65,13 @@ ImageEditorManger *imageEditorManager = nil;
}
UIEdgeInsets safeInsets = UIEdgeInsetsMake(0, 0, 0, 0);
if (@available(iOS 11.0, *)) {
safeInsets = currentWindow.safeAreaInsets;
safeInsets = rootView.safeAreaInsets;
NSLog(@" safe insets %.2f, %.2f", safeInsets.top, safeInsets.bottom);
} else {
}
CGSize size = currentWindow.screen.bounds.size;
[self.browser showToView:currentWindow containerRect:CGRectMake(safeInsets.left, safeInsets.top, size.width - safeInsets.left - safeInsets.right, size.height - safeInsets.top - safeInsets.bottom)];
CGSize size = rootView.bounds.size;
[self.browser showToView:rootView containerRect:CGRectMake(safeInsets.left, safeInsets.top, size.width - safeInsets.left - safeInsets.right, size.height - safeInsets.top - safeInsets.bottom)];
}
#pragma mark - private
......@@ -89,7 +89,7 @@ ImageEditorManger *imageEditorManager = nil;
[self toEditVC:lfPhotoEditVC];
[self.browser.defaultToolViewHandler.sheetView hideWithAnimation:YES];
} else {
[imgData.yb_auxiliaryViewHandler() yb_showIncorrectToastWithContainer:[Utils currentWindow] text:@"图片未加载完成"];
[imgData.yb_auxiliaryViewHandler() yb_showIncorrectToastWithContainer:[Utils getCurrentVC].view text:@"图片未加载完成"];
}
}
......
......@@ -18,7 +18,7 @@ NSString *const LFMediaEditingStrings = @"LFMediaEditingController";
static NSBundle *lfMediaEditingBundle = nil;
if (lfMediaEditingBundle == nil) {
// 这里不使用mainBundle是为了适配pod 1.x和0.x
lfMediaEditingBundle = [NSBundle bundleWithPath:[[NSBundle bundleForClass:[LFBaseEditingController class]] pathForResource:@"LFMediaEditingController" ofType:@"bundle"]];
lfMediaEditingBundle = [NSBundle bundleWithPath:[[NSBundle bundleForClass:[LFBaseEditingController class]] pathForResource:@"LFMediaEditingController.bundle/LFMediaEditingController" ofType:@"bundle"]];
}
return lfMediaEditingBundle;
}
......
......@@ -14,8 +14,8 @@ Pod::Spec.new do |s|
s.source = { :git => "https://github.com/author/RNGeekImageEditor.git", :tag => "master" }
s.source_files = "**/*.{h,m}"
s.resource_bundles = {
"YBImageBrowser" => ['YBImageBrowser/**/*.bundle'],
"LFMediaEditingController" => ['LFMediaEditingController/**/*.bundle']
"YBImageBrowser" => 'YBImageBrowser/**/*.bundle',
"LFMediaEditingController" => 'LFMediaEditingController/**/*.bundle'
}
s.resource = "CheckView/**/*.{png, xib}"
s.requires_arc = true
......
......@@ -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];
}
......
......@@ -74,7 +74,7 @@ NSBundle *YBIBDefaultBundle(void) {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
NSBundle *_bundle = [NSBundle bundleForClass:NSClassFromString(@"YBImageBrowser")];
NSString *path = [_bundle pathForResource:@"YBImageBrowser" ofType:@"bundle"];
NSString *path = [_bundle pathForResource:@"YBImageBrowser.bundle/YBImageBrowser" ofType:@"bundle"];
bundle = [NSBundle bundleWithPath:path];
});
return bundle;
......
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