SPAlertController icon indicating copy to clipboard operation
SPAlertController copied to clipboard

直接放在viewDidLoad里面是弹不出来的

Open Jean1992 opened this issue 6 years ago • 8 comments

delay个0.5秒之后present就可以,但是系统的UIAlertViewController则没这个bug,本想用这个库替换整个项目里面的原生alert,但是很多地方都在didLoad里面做的弹窗。。。

Jean1992 avatar Aug 19 '19 01:08 Jean1992

望修复

Jean1992 avatar Aug 19 '19 01:08 Jean1992

弹不出来的原因是,SPAlertViewController的view的frame是{0,0,0,0}

Jean1992 avatar Aug 19 '19 01:08 Jean1992

好的,我试试

乐升平 许思必客行 中华人民共和国

手机:13879857085 邮箱:[email protected]

电话:000-00000000 地址:上海市浦东新区居里路99号

在2019年08月19日 09:28,JeanKit[email protected] 写道:

delay个0.5秒之后present就可以,但是系统的UIAlertViewController则没这个bug,本想用这个库替换整个项目里面的原生alert,但是很多地方都在didLoad里面做的弹窗。。。

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

SPStore avatar Aug 20 '19 05:08 SPStore

你好,我试了是能弹出来的,你能把你写的给我看下吗,跟我的有什么不同之处

乐升平 许思必客行 中华人民共和国

手机:13879857085 邮箱:[email protected]

电话:000-00000000 地址:上海市浦东新区居里路99号

在2019年08月19日 09:29,JeanKit[email protected] 写道:

弹不出来的原因是,SPAlertViewController的view的frame是{0,0,0,0}

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

SPStore avatar Aug 20 '19 05:08 SPStore

- (void)viewDidLoad {
    [super viewDidLoad];
    
    SPAlertController *sc = [SPAlertController alertControllerWithCustomAlertView:({ UIView *view = UIView.new; view.size = (CGSize){200,200}; view.backgroundColor = UIColor.whiteColor; view; }) 
    preferredStyle:SPAlertControllerStyleAlert animationType:SPAlertAnimationTypeExpand];
    [sc setBackgroundViewAppearanceStyle:SPBackgroundViewAppearanceStyleBlurDark alpha:1];
    [sc setTapBackgroundViewDismiss:NO];
    [self presentViewController:sc animated:YES completion:nil];
}

以上是代码,可以复制直接跑。。。

还有个问题,两个SPAlertController(简称sa)按顺序弹出,第一个没有dismiss掉的情况下,会自动dismiss掉,只剩下第二个。 或者一个sa先弹出,然后一个ua(原生那个)弹出,sp也会dismiss掉。 原生ua那个是将前面的隐藏起来,每操作掉一个,前一个就会重新冒出来。

Jean1992 avatar Aug 20 '19 06:08 Jean1992

我复制你的代码,还是弹出来了,唯一不同的就是设置view的size,因为我没有写分类去直接设置view的size,我设置的是frame,不过这不会有影响。你说的第二个问题,我稍后给你回复,先把你的第一个问题解决 乐升平 许思必客行 中华人民共和国

手机:13879857085 邮箱:[email protected]

电话:000-00000000 地址:上海市浦东新区居里路99号

在2019年08月20日 14:06,JeanKit[email protected] 写道:

  • (void)viewDidLoad {

    [superviewDidLoad];

    SPAlertController *sc = [SPAlertController alertControllerWithCustomAlertView:({ UIView *view = UIView.new; view.size = (CGSize){200,200}; view.backgroundColor = UIColor.whiteColor; view; })

    preferredStyle:SPAlertControllerStyleAlert animationType:SPAlertAnimationTypeExpand];

    [sc setBackgroundViewAppearanceStyle:SPBackgroundViewAppearanceStyleBlurDark alpha:1];

    [sc setTapBackgroundViewDismiss:NO];

    [selfpresentViewController:sc animated:YEScompletion:nil];

}

以上是代码,可以复制直接跑。。。

还有个问题,两个SPAlertController(简称sa)按顺序弹出,第一个没有dismiss掉的情况下,会自动dismiss掉,只剩下第二个。 或者一个sa先弹出,然后一个ua(原生那个)弹出,sp也会dismiss掉。 原生ua那个是将前面的隐藏起来,每操作掉一个,前一个就会重新冒出来。

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

SPStore avatar Aug 20 '19 06:08 SPStore

你的viewDidLoad所在的控制器,是不是被present出来的。如果是被present出来的,然后在viewDidLoad中弹出SPAlertController确实弹不出来,单丝我试了系统的也是弹不出来的。都是报警告:Warning: Attempt to present <UIAlertController: 0x101815a00> on <SencondViewController: 0x1014457d0> whose view is not in the window hierarchy!

加我微信:13879857085,沟通更方便 乐升平 许思必客行 中华人民共和国

手机:13879857085 邮箱:[email protected]

电话:000-00000000 地址:上海市浦东新区居里路99号

在2019年08月20日 14:16,乐升平[email protected] 写道: 我复制你的代码,还是弹出来了,唯一不同的就是设置view的size,因为我没有写分类去直接设置view的size,我设置的是frame,不过这不会有影响。你说的第二个问题,我稍后给你回复,先把你的第一个问题解决 乐升平 许思必客行 中华人民共和国

手机:13879857085 邮箱:[email protected]

电话:000-00000000 地址:上海市浦东新区居里路99号

在2019年08月20日 14:06,JeanKit[email protected] 写道:

  • (void)viewDidLoad {

    [superviewDidLoad];

    SPAlertController *sc = [SPAlertController alertControllerWithCustomAlertView:({ UIView *view = UIView.new; view.size = (CGSize){200,200}; view.backgroundColor = UIColor.whiteColor; view; })

    preferredStyle:SPAlertControllerStyleAlert animationType:SPAlertAnimationTypeExpand];

    [sc setBackgroundViewAppearanceStyle:SPBackgroundViewAppearanceStyleBlurDark alpha:1];

    [sc setTapBackgroundViewDismiss:NO];

    [selfpresentViewController:sc animated:YEScompletion:nil];

}

以上是代码,可以复制直接跑。。。

还有个问题,两个SPAlertController(简称sa)按顺序弹出,第一个没有dismiss掉的情况下,会自动dismiss掉,只剩下第二个。 或者一个sa先弹出,然后一个ua(原生那个)弹出,sp也会dismiss掉。 原生ua那个是将前面的隐藏起来,每操作掉一个,前一个就会重新冒出来。

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

SPStore avatar Aug 20 '19 06:08 SPStore

加我微信:13879857085,沟通更方便

乐升平 许思必客行 中华人民共和国

手机:13879857085 邮箱:[email protected]

电话:000-00000000 地址:上海市浦东新区居里路99号

在2019年08月20日 14:25,乐升平[email protected] 写道: 你的viewDidLoad所在的控制器,是不是被present出来的。如果是被present出来的,然后在viewDidLoad中弹出SPAlertController确实弹不出来,单丝我试了系统的也是弹不出来的。都是报警告:Warning: Attempt to present <UIAlertController: 0x101815a00> on <SencondViewController: 0x1014457d0> whose view is not in the window hierarchy!

加我微信:13879857085,沟通更方便 乐升平 许思必客行 中华人民共和国

手机:13879857085 邮箱:[email protected]

电话:000-00000000 地址:上海市浦东新区居里路99号

在2019年08月20日 14:16,乐升平[email protected] 写道: 我复制你的代码,还是弹出来了,唯一不同的就是设置view的size,因为我没有写分类去直接设置view的size,我设置的是frame,不过这不会有影响。你说的第二个问题,我稍后给你回复,先把你的第一个问题解决 乐升平 许思必客行 中华人民共和国

手机:13879857085 邮箱:[email protected]

电话:000-00000000 地址:上海市浦东新区居里路99号

在2019年08月20日 14:06,JeanKit[email protected] 写道:

  • (void)viewDidLoad {

    [superviewDidLoad];

    SPAlertController *sc = [SPAlertController alertControllerWithCustomAlertView:({ UIView *view = UIView.new; view.size = (CGSize){200,200}; view.backgroundColor = UIColor.whiteColor; view; })

    preferredStyle:SPAlertControllerStyleAlert animationType:SPAlertAnimationTypeExpand];

    [sc setBackgroundViewAppearanceStyle:SPBackgroundViewAppearanceStyleBlurDark alpha:1];

    [sc setTapBackgroundViewDismiss:NO];

    [selfpresentViewController:sc animated:YEScompletion:nil];

}

以上是代码,可以复制直接跑。。。

还有个问题,两个SPAlertController(简称sa)按顺序弹出,第一个没有dismiss掉的情况下,会自动dismiss掉,只剩下第二个。 或者一个sa先弹出,然后一个ua(原生那个)弹出,sp也会dismiss掉。 原生ua那个是将前面的隐藏起来,每操作掉一个,前一个就会重新冒出来。

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

SPStore avatar Aug 20 '19 06:08 SPStore