Giter Site home page Giter Site logo

spstore / spalertcontroller Goto Github PK

View Code? Open in Web Editor NEW
429.0 14.0 68.0 19.24 MB

提醒对话框,风格和微信原生几乎零误差。简书地址:

Home Page: https://www.jianshu.com/p/f55b98c352a7

License: MIT License

Objective-C 98.78% Ruby 1.22%
alertview alertcontroller uialertcontroller spalertcontroller uialertview uistackview

spalertcontroller's People

Contributors

spstore avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spalertcontroller's Issues

新版本不设置title不会弹出

新版本不设置title不会弹出,demo测试可以,放到项目就不行了,新版本不知道为什么不行,换回老版本就可以了,

使用alertControllerWithTitle初始化title和message都为空的情况下,不能弹出弹窗

调试发现此时alertController的view高度为0,导致各子view都无法显示出来。

SPAlertController *alertController = [SPAlertController alertControllerWithTitle:nil message:nil preferredStyle:SPAlertControllerStyleActionSheet];
alertController.needDialogBlur = YES;

    SPAlertAction *actionQuit = [SPAlertAction actionWithTitle:CMString(@"自己", nil) style:SPAlertActionStyleDefault handler:^(SPAlertAction * _Nonnull action) {
    }];
    [alertController addAction:actionQuit];

    SPAlertAction *actionKill = [SPAlertAction actionWithTitle:CMString(@"他人", nil) style:SPAlertActionStyleDestructive handler:^(SPAlertAction * _Nonnull action) {
    }];
    [alertController addAction:actionKill];

SPAlertAction *actionCancel = [SPAlertAction actionWithTitle:CMString(@"取消", nil) style:SPAlertActionStyleCancel handler:^(SPAlertAction * _Nonnull action) {
}];
[alertController addAction:actionCancel];

[self presentViewController:alertController animated:YES completion:^{}];

alertView的bug

message文字较多的化,alert的小标题显示有问题,scrollew可滑动

crash

  Trapped uncaught exception 'NSGenericException', reason: 'Unable to install constraint on view.  Does the constraint reference something from outside the subtree of the view?  That's illegal. constraint:<NSLayoutConstraint:0x1c029d650 UIView:0x1076ebcc0.width == 414> view:<UITransitionView: 0x112c66cf0; frame = (0 0; 414 736); autoresize = W+H; layer = <CALayer: 0x1c04380c0>>' 
(
	0   CoreFoundation                      0x000000018376e37c <redacted> + 148
	1   libobjc.A.dylib                     0x00000001829b4528 objc_exception_throw + 56
	2   CoreFoundation                      0x000000018376e2ac <redacted> + 0
	3   Foundation                          0x00000001840ab9a0 <redacted> + 236
	4   UIKit                               0x000000018cd3725c <redacted> + 488
	5   UIKit                               0x000000018cd37038 <redacted> + 36
	6   UIKit                               0x000000018cd40134 <redacted> + 176
	7   Foundation                          0x00000001840ab4dc <redacted> + 168
	8   UIKit                               0x000000018cd3fffc <redacted> + 164
	9   *******                             0x0000000104f88b98 -[SPAlertPresentationController updateConstraints] + 7648
	10  *******                             0x0000000104f86708 -[SPAlertPresentationController containerViewWillLayoutSubviews] + 200
	11  UIKit                               0x000000018cc4ce38 <redacted> + 1076
	12  QuartzCore                          0x00000001877b1998 <redacted> + 184
	13  QuartzCore                          0x00000001877b5b20 <redacted> + 332
	14  QuartzCore                          0x000000018772236c <redacted> + 336
	15  QuartzCore                          0x0000000187749b90 <redacted> + 540
	16  UIKit                               0x000000018cc425c8 <redacted> + 256
	17  CoreFoundation                      0x0000000183715edc <redacted> + 32
	18  CoreFoundation                      0x0000000183713894 <redacted> + 412
	19  CoreFoundation                      0x0000000183713e50 <redacted> + 1292
	20  CoreFoundation                      0x0000000183633e58 CFRunLoopRunSpecific + 436
	21  GraphicsServices                    0x00000001854e0f84 GSEventRunModal + 100
	22  UIKit                               0x000000018ccb367c UIApplicationMain + 236
	23  *******                             0x0000000104c0f658 main + 184
	24  libdyld.dylib                       0x000000018315056c <redacted> + 4
)

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

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

不设置title和message AlertAction 回调无效

SPAlertController *alertController = [SPAlertController alertControllerWithTitle:nil
message:nil
preferredStyle:SPAlertControllerStyleActionSheet];
SPAlertAction *contact = [SPAlertAction actionWithTitle:ASLocalized(@"解除绑定")
style:SPAlertActionStyleDefault
handler:^(SPAlertAction * _Nonnull action) {

                                 NSLog(@"无效");           
}];
SPAlertAction *cacel = [SPAlertAction actionWithTitle:ASLocalized(@"取消") style:SPAlertActionStyleDefault handler:nil];
[alertController addAction:contact];
[alertController addAction:cacel];
// 设置对话框不需要毛玻璃
alertController.needDialogBlur = NO;
[self presentViewController:alertController animated:YES completion:nil];

能否设置 action按钮的背景色?

你是全部封装在.m里面 ,我拿不到。runtime只能拿第一层:
Ivar ivar = class_getInstanceVariable([SPAlertController class], "_headerView");//必须是下划线接属性
UIView *view = object_getIvar(self.spaVC, ivar);
view.backgroundColor = kRedColor;

但是我要改按钮背景色怎么做?不想把pod的东西提出来改,最大限度尊重原作者。

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

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

cancel按钮的高度问题

因为我看微信的cancel按钮在iPhone X上是将底部全部包含进去的,跟您demo的样式不太一致,请教在哪里修改cancel的高度啊

Message文字

Message文字过多,就变成scrollview滚动,如何设置弹框的高度啊

UIViewController的弹窗类型

SPAlertController *alertController = [SPAlertController alertControllerWithTitle:@"111" message:@"111" preferredStyle:SPAlertControllerStyleAlert animationType:SPAlertAnimationTypeExpand];
alertController.textAlignment = NSTextAlignmentLeft;
[self presentViewController:alertController animated:YES completion:^{}];
这里如果修改为alertController.modalPresentationStyle = UIModalPresentationFullScreen;
背景会变为白的,并且点击不会消失。
请问这个应该怎么修改

你好,下面方式, alert不能弹出,还会造成界面卡死

SPAlertController *alertController = [SPAlertController alertControllerWithTitle:@"请选择变更的场景,变更后报警规则将重置" message:@"subtile" preferredStyle:SPAlertControllerStyleActionSheet animationType:SPAlertAnimationTypeFromBottom];

SPAlertAction *new = [SPAlertAction actionWithTitle:@"+ 新建场景" style:SPAlertActionStyleDestructive handler:^(SPAlertAction * _Nonnull action) {

    NSLog(@"点击了 新建场景");

}];

SPAlertAction *cancel = [SPAlertAction actionWithTitle:@"取消" style:SPAlertActionStyleCancel handler:^(SPAlertAction * _Nonnull action) {

    NSLog(@"点击了Cancel");

}];

[alertController addAction:new];
[alertController addAction:cancel];

[alertController setBackgroundViewAppearanceStyle:appearanceStyle alpha:0.5];

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.