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

0.0.9 更新日志 #21

Open
xaoxuu opened this issue May 29, 2017 · 0 comments
Open

0.0.9 更新日志 #21

xaoxuu opened this issue May 29, 2017 · 0 comments

Comments

@xaoxuu
Copy link
Owner

xaoxuu commented May 29, 2017

快速创建UIActivityIndicatorView

UIActivityIndicatorView *indicator = [UIActivityIndicatorView defaultIndicator];
// @xaoxuu: 显示到self.view中心
indicator.show(self.view);
// @xaoxuu: 隐藏
indicator.hide();

功能简单不需要解释,下面有效果图

UIAlertController++

快速

// @xaoxuu: 一行代码的消息弹窗
[UIAlertController ax_showAlertWithTitle:@"Hello Alert" message:@"这是用一行代码弹出来的只有一个按钮的窗口" action:nil];

// @xaoxuu: 最常用的【取消】+【确定】弹窗
[UIAlertController ax_showAlertWithTitle:@"Hello Alert" message:@"这是用一个方法弹出来的有两个按钮的窗口" ok:^(UIAlertAction * _Nonnull sender) {
    AXLogFormat(@"点击了OK按钮");
}];

效果图:

只有一个按钮 两个按钮
simulator screen shot 29 may 2017 2 32 46 pm simulator screen shot 29 may 2017 2 33 37 pm

方法简单,但功能不受限

[UIAlertController ax_showAlertWithTitle:@"Hello Alert" message:@"这是用一个方法弹出来的完全自定义的系统弹窗" action:^(UIAlertController * _Nonnull alert) {
    // @xaoxuu: 添加取消按钮
    [alert ax_addCancelAction];

    // @xaoxuu: 破坏性按钮(标题为【Confirm】)
    [alert ax_addDestructiveActionWithTitle:nil handler:^(UIAlertAction * _Nonnull sender) {

    }];
    // @xaoxuu: 自定义标题的破坏性按钮
    [alert ax_addDestructiveActionWithTitle:@"删除2" handler:^(UIAlertAction * _Nonnull sender) {

    }];
    // @xaoxuu: 普通按钮(默认标题为【OK】)
    [alert ax_addDefaultActionWithTitle:nil handler:^(UIAlertAction * _Nonnull sender) {

    }];
    // @xaoxuu: 自定义标题的普通按钮
    [alert ax_addDefaultActionWithTitle:@"确定2" handler:^(UIAlertAction * _Nonnull sender) {

    }];

}];
// @xaoxuu: 自定义视图的系统弹窗
[UIAlertController ax_showAlertWithTitle:nil message:@"\n\n\n\n\n\n\n\n\n\n\n" action:^(UIAlertController * _Nonnull alert) {
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(8, 8, 270-16, 222.3-16)];
    view.backgroundColor = [UIColor md_yellow];
    view.layer.masksToBounds = YES;
    view.layer.cornerRadius = 8;

    [UIActivityIndicatorView defaultIndicator].show(view);

    [alert.view addSubview:view];

}];

效果图:

自定义按钮 自定义视图
simulator screen shot 29 may 2017 2 36 04 pm simulator screen shot 29 may 2017 2 45 07 pm
@xaoxuu xaoxuu changed the title 0.0.9 更新日志 0.0.9更新日志 May 29, 2017
@xaoxuu xaoxuu changed the title 0.0.9更新日志 0.0.9 更新日志 May 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant