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

LGAlertView do not show #80

Open
zhouzheren opened this issue Apr 20, 2022 · 2 comments
Open

LGAlertView do not show #80

zhouzheren opened this issue Apr 20, 2022 · 2 comments

Comments

@zhouzheren
Copy link

LGAlertView *view = [[LGAlertView alloc] initWithTitle:@"Title"
message:@"Message"
style:LGAlertViewStyleActionSheet
buttonTitles:@[@"Button 1", @"Button 2"]
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"Destructive"
delegate:self];
view.backgroundColor = [UIColor blackColor];

    [view showAnimated];
@zhouzheren
Copy link
Author

[LGAlertViewHelper
animateWithDuration:self.animationDuration
animations:^(void) {
[self showAnimations];

         // -----

         [[NSNotificationCenter defaultCenter] postNotificationName:LGAlertViewShowAnimationsNotification
                                                             object:self
                                                           userInfo:@{kLGAlertViewAnimationDuration: @(self.animationDuration)}];

         if (self.showAnimationsBlock) {
             self.showAnimationsBlock(self, self.animationDuration);
         }

         if (self.delegate && [self.delegate respondsToSelector:@selector(showAnimationsForAlertView:duration:)]) {
             [self.delegate showAnimationsForAlertView:self duration:self.animationDuration];
         }
     }
     completion:^(BOOL finished) {
         if (!hidden) {
             [self showComplete];
         }

         if (completionHandler) {
             completionHandler();
         }
     }];

finished 值为 NO,界面上也没有Alert展示出来, demo中 finished的值是YES,还没有找到根因。

@doasyourself
Copy link

// iOS13以上需要设置UIScene,否则不显示
if (@available(iOS 13, *))
{
UIScene *scene = [[[UIApplication sharedApplication].connectedScenes allObjects] firstObject];
self.window.windowScene = scene;
}

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

No branches or pull requests

2 participants