Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为什么在 iOS 13 系统中显示在左上角???????????? #1043

Closed
iOSSer opened this issue Jun 20, 2020 · 17 comments · May be fixed by #1088
Closed

为什么在 iOS 13 系统中显示在左上角???????????? #1043

iOSSer opened this issue Jun 20, 2020 · 17 comments · May be fixed by #1088

Comments

@iOSSer
Copy link

iOSSer commented Jun 20, 2020

why?
没有加这句还会闪退: @Property (strong, nonatomic) UIWindow *window;

@czl0325
Copy link

czl0325 commented Jul 7, 2020

同问!!!

@Azraeltulips
Copy link

iOS13多了一个SceneDelegate类,导致获取不到window了

@Azraeltulips
Copy link

在源码SVProgressHUD.m文件中第638行self.frame = [[[UIApplication sharedApplication] delegate] window].bounds这句改成
self.frame= [UIApplication sharedApplication].keyWindow.bounds这个应该就可以了

@iOSSer
Copy link
Author

iOSSer commented Jul 15, 2020

在源码SVProgressHUD.m文件中第638行self.frame = [[[UIApplication sharedApplication] delegate] window].bounds这句改成
self.frame= [UIApplication sharedApplication].keyWindow.bounds这个应该就可以了

改了还是不行:

  • (void)positionHUD:(NSNotification*)notification {
    CGFloat keyboardHeight = 0.0f;
    double animationDuration = 0.0;

#if !defined(SV_APP_EXTENSIONS) && TARGET_OS_IOS
self.frame = UIApplication.sharedApplication.keyWindow.bounds;
UIInterfaceOrientation orientation = UIApplication.sharedApplication.statusBarOrientation;
#elif !defined(SV_APP_EXTENSIONS) && !TARGET_OS_IOS
self.frame= [UIApplication sharedApplication].keyWindow.bounds;
#else

字号不一样行数不一样,建议直接说方法名

@Azraeltulips
Copy link

在源码SVProgressHUD.m文件中第638行self.frame = [[[UIApplication sharedApplication] delegate] window].bounds这句改成
self.frame= [UIApplication sharedApplication].keyWindow.bounds这个应该就可以了

改了还是不行:

  • (void)positionHUD:(NSNotification*)notification {
    CGFloat keyboardHeight = 0.0f;
    double animationDuration = 0.0;

#if !defined(SV_APP_EXTENSIONS) && TARGET_OS_IOS
self.frame = UIApplication.sharedApplication.keyWindow.bounds;
UIInterfaceOrientation orientation = UIApplication.sharedApplication.statusBarOrientation;
#elif !defined(SV_APP_EXTENSIONS) && !TARGET_OS_IOS
self.frame= [UIApplication sharedApplication].keyWindow.bounds;
#else

字号不一样行数不一样,建议直接说方法名

就是这里,我这边这样修改之后就没有问题了,不知道你这个为什么不行。目前只找到了这个解决办法

@Azraeltulips
Copy link

Azraeltulips commented Jul 15, 2020

在源码SVProgressHUD.m文件中第638行self.frame = [[[UIApplication sharedApplication] delegate] window].bounds这句改成
self.frame= [UIApplication sharedApplication].keyWindow.bounds这个应该就可以了

改了还是不行:

  • (void)positionHUD:(NSNotification*)notification {
    CGFloat keyboardHeight = 0.0f;
    double animationDuration = 0.0;

#if !defined(SV_APP_EXTENSIONS) && TARGET_OS_IOS
self.frame = UIApplication.sharedApplication.keyWindow.bounds;
UIInterfaceOrientation orientation = UIApplication.sharedApplication.statusBarOrientation;
#elif !defined(SV_APP_EXTENSIONS) && !TARGET_OS_IOS
self.frame= [UIApplication sharedApplication].keyWindow.bounds;
#else
字号不一样行数不一样,建议直接说方法名

就是这里,我这边这样修改之后就没有问题了,不知道你这个为什么不行。目前只找到了这个解决办法

你可以在这里打断点调试 如果self.frame有值,那就不是这个问题了,可能是其他问题。或者你直接给frame一个固定值试试

@AlianOL
Copy link

AlianOL commented Jul 17, 2020

在源码SVProgressHUD.m文件中第638行self.frame = [[[UIApplication sharedApplication] delegate] window].bounds这句改成
self.frame= [UIApplication sharedApplication].keyWindow.bounds这个应该就可以了

改了还是不行:

  • (void)positionHUD:(NSNotification*)notification {
    CGFloat keyboardHeight = 0.0f;
    double animationDuration = 0.0;

#if !defined(SV_APP_EXTENSIONS) && TARGET_OS_IOS
self.frame = UIApplication.sharedApplication.keyWindow.bounds;
UIInterfaceOrientation orientation = UIApplication.sharedApplication.statusBarOrientation;
#elif !defined(SV_APP_EXTENSIONS) && !TARGET_OS_IOS
self.frame= [UIApplication sharedApplication].keyWindow.bounds;
#else
字号不一样行数不一样,建议直接说方法名

就是这里,我这边这样修改之后就没有问题了,不知道你这个为什么不行。目前只找到了这个解决办法

你可以在这里打断点调试 如果self.frame有值,那就不是这个问题了,可能是其他问题。或者你直接给frame一个固定值试试

CGRectMake设置frame系统就不走那个方法了。。不知道为啥

@flyweights
Copy link

我也遇到了同样的问题啊,醉了。。。。

@AlianOL
Copy link

AlianOL commented Aug 4, 2020

我也遇到了同样的问题啊,醉了。。。。

到现在也没解决这个问题。。忍痛不用sv了。。好可惜

@iOSSer
Copy link
Author

iOSSer commented Sep 24, 2020

XCode 11 & iOS 13+ ,add code:
@property (nonatomic, strong) UIWindow *window;
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]

@stale
Copy link

stale bot commented Jun 26, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue was overlooked, forgotten, or should remain open for any other reason, please reply here to call attention to it and remove the stale status. Thank you for your contributions.

@stale stale bot added the stale label Jun 26, 2021
@CoderAquarius
Copy link

Yes, the huge problem remains

@stale
Copy link

stale bot commented Jan 9, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue was overlooked, forgotten, or should remain open for any other reason, please reply here to call attention to it and remove the stale status. Thank you for your contributions.

@stale stale bot added the stale label Jan 9, 2022
@Butterfly7777777
Copy link

同样碰到,神坑

@stale stale bot removed the stale label Mar 25, 2022
@hllGitHub
Copy link

You can add this in the AppDelegate. It works well.

var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
  self.window = UIWindow(frame: UIScreen.main.bounds)
  return true
}

This issue is caused by Window.

@AlainXu-SE
Copy link

XCode 11 & iOS 13+ ,add code: @property (nonatomic, strong) UIWindow *window; self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]

Thank you, this save my day!

@honkmaster
Copy link
Member

I've updated the component and addressed several bugs. Please review version 2.3.0, and should you find any remaining issues, your feedback would be greatly valued.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants