uialertview 图片_这个一个与系统UIAlertController相似的中间弹出的alertView,写…

项目介绍:

这个一个与系统UIAlertController相似的中间弹出的alertView,写这个是为了方便修改字体颜色、字体大小、间距等,现在的美工很膨胀,什么款都能搞出来!~~~

先看效果

描述

使用方法 将轮子文件夹MLAlertView拖到自己项目导入#import "MLAlertView.h"即可

1.创建

MLAlertView *alert = [[MLAlertView alloc] initWithTitle:@"提交成功" andMessage:@"上海港货物吞吐量和集装箱吞吐量均居世界第一" andMessageAlignment:NSTextAlignmentCenter andItem:@[@"知道了"] andSelectBlock:^(NSInteger index) {    NSLog(@"index->%ld",index);}];

复制代码

2.设置需要的属性

//横线和竖线的颜色alert.lineViewColor = [UIColor colorWithRed:220/255.0 green:220/255.0 blue:220/255.0 alpha:1];//副标题或描述的字体颜色alert.messageLabelColor = [UIColor redColor];//按钮item的颜色数组 按顺序取 实际最多只有3个按钮 如果颜色数组只有两个颜色,则最后一个颜色按钮是默认色,如果颜色数组颜色多了,只取前3个值NSArray *colorArr = @[[UIColor greenColor]];alert.itemTitleColorArr = colorArr;//副标题或描述的颜色alert.messageLabelColor = [UIColor grayColor];alert.buttonFont = [UIFont systemFontOfSize:18 weight:550];alert.transverseLineHidden = YES;//设置副标题某段文字的颜色 如果设置了副标题颜色messageLabelColor,必须放在前面,否则此处设置无效,会被messageLabelColor覆盖,没有设置副标题则此处设置无效[alert messageLabelTextColorWith:NSMakeRange(15, 6) andColor:[UIColor orangeColor]];

3.调用下面之一的show方法就可以弹出来了

if (self.tabBarController.view) {    [alert showWithView:self.tabBarController.view];    }else if (self.navigationController.view) {    [alert showWithView:self.navigationController.view];}else{    [alert showWithView:self.view];}

复制代码

GitHub地址:https://github.com/longmaboy/AlertView喜欢的小伙伴可以关注一下!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值