Latest 1.0.0
Homepage https://github.com/slagslag/SGAlertController
License MIT
Platforms ios 8.0
Authors

详见 SGAlertController.h

系统提示框的封装,传入标题、内容。传入 取消、确定、其他选项.
可选择提示样式: AlertSheet

Author

slagslag, [email protected]

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

SGAlertController is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'SGAlertController'
// 创建
[SGAlertController alertWithStyle:_style
title:@"语言选择"
message:@"请选择你最喜欢的语言!"
cancel:@"取消" sure:@""
settings:^(SGAlertController *alertView) {
// 修改显示样式
[alertView changTitleStyle:(ActionTitleStyleMake([UIColor randomColor], [UIFont boldSystemFontOfSize:20]))];
[alertView changMessageStyle:(ActionTitleStyleMake([UIColor randomColor], [UIFont systemFontOfSize:15]))];
[alertView changActionTitleColor:[UIColor redColor] actionTitle:@"Objective - C"];
[alertView changActionTitleColor:[UIColor yellowColor] index:5];
}
selectorAction:^(NSString *title, NSInteger index) {
if (index != 0) {
[_showBtn setTitle:title forState:(UIControlStateNormal)];
}
}
otherTitles:@"JavaScript", @"Objective - C",@"Java",@"Python",@"HTML",@"Ruby",@"C++", nil];

修改样式

  • 修改标题
// 可使用 ActionTitleStyleMake() 传入
ActionTitleStyleMake([UIColor redColor], [UIFont boldSystemFontOfSize:20])
[alertView changMessageStyle:<#(ActionTitleStyle)#>]

// 可传入 AttributedString
[alertView changTitleAttributedString:]
  • 修改内容
// 可使用 ActionTitleStyleMake() 传入
ActionTitleStyleMake([UIColor redColor], [UIFont boldSystemFontOfSize:20])
[alertView changMessageStyle:<#(ActionTitleStyle)#>]

// 可传入 AttributedString
[alertView changMessageAttributedString:]
  • 修改某个 Action

action 改变样式 需在 present 之前。使用 settings .

// 根据标题改变颜色
- (void)changActionTitleColor:(UIColor * _Nonnull)color actionTitle:(NSString *_Nonnull)title;

// 根据位置改变颜色
- (void)changActionTitleColor:(UIColor *)color index:(NSInteger)index;

Latest podspec

{
    "name": "SGAlertController",
    "version": "1.0.0",
    "summary": "u7cfbu7edf UIAlertController u4f7fu7528u5c01u88c5.",
    "description": "u7cfbu7edf UIAlertController u4f7fu7528u5c01u88c5.",
    "homepage": "https://github.com/slagslag/SGAlertController",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "slagslag": "[email protected]"
    },
    "source": {
        "git": "https://github.com/slagslag/SGAlertController.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "SGAlertController/Classes/**/*"
}

Pin It on Pinterest

Share This