MSAlertVC 1.0.1

MSAlertVC 1.0.1

Maintained by MSAlertController.



MSAlertVC 1.0.1

  • By
  • MSAlertController

MSAlertController

一个高仿微博和微信的底部弹窗

License MIT  CocoaPods  CocoaPods  Support 

效果展示

MSAlertController                                       微信                                                      微博

更多效果展示图

系统要求

该项目最低支持iOS 8.0Xcode 7.0

安装

注:为了支持CocoaPods安装,但是MSAlertController已被人抢占,不得已只能将CocoaPods库中的名字改为MSAlertVC,因此在安装完MSAlertVC后,引入头文件应该为MSAlertController.h,而非MSAlertVC.h

CocoaPods

  1. 在 Podfile 中添加 pod 'MSAlertVC'
  2. 执行 pod installpod update
  3. 导入头文件:#import <MSAlertController.h>

手动安装

  1. 下载 MSAlertVC 项目;
  2. MSAlertController 文件夹直接拖入项目中;
  3. 导入头文件:#import "MSAlertController.h"

使用方法

1.初始化MSAlertController

+ (_Nonnull instancetype)alertControllerWithArray:(nonnull NSArray <NSString *> *)confirmArray;

2.自定义属性

title
rowHeight

3.自定义方法

// 设置第index行的按钮的颜色(可选实现的方法)
- (void)setColor:(nonnull UIColor *)color withIndex:(NSInteger)index;
// 设置第index行的按钮的字体(可选实现的方法)
- (void)setFont:(nonnull UIFont *)font withIndex:(NSInteger)index;
// 设置取消按钮的文字内容和颜色字体(可选实现的方法)
- (void)setCancleButtonTitle:(nonnull NSString *)title font:(nonnull UIFont *)font color:(nonnull UIColor *)color;

4.点击事件

- (void)addConfirmButtonAction:(nullable MSButtonBlock)block;

使用示例

示例1

NSArray *arr = @[@"保存图片", @"转发微博", @"赞"];
MSAlertController *alertVC = [MSAlertController alertControllerWithArray:arr];
[alertVC addConfirmButtonAction:^(NSInteger index, BOOL cancle) {
    if (cancle) {
        NSLog(@"你点击了取消按钮");
        return;
    } 
    NSLog(@"你点击的是:%@", arr[index]);
}];
[self presentViewController:alertVC animated:NO completion:nil];

示例2

MSAlertController *unfollowAlertVC = [MSAlertController alertControllerWithArray:@[@"不再关注"]];
unfollowAlertVC.title = @"你确定不再关注MS了吗?";
[unfollowAlertVC setColor:[UIColor redColor] withIndex:0];
[unfollowAlertVC addConfirmButtonAction:^(NSInteger index, BOOL cancle) {
    if (cancle) {
        NSLog(@"你点击了取消按钮");
        return;
    }
    NSLog(@"果取关");
}];
[self presentViewController:unfollowAlertVC animated:NO completion:nil];

许可证

MSAlertController 使用 MIT 许可证,详情见 LICENSE 文件。