无为清净楼资源网 Design By www.qnjia.com
首先来看看实现的效果图
下面话不多说,以下是实现的示例代码
#import <UIKit/UIKit.h> typedef void(^AlertResult)(NSInteger index); @interface XLAlertView : UIView @property (nonatomic,copy) AlertResult resultIndex; - (instancetype)initWithTitle:(NSString *)title message:(NSString *)message sureBtn:(NSString *)sureTitle cancleBtn:(NSString *)cancleTitle; - (void)showXLAlertView; @end
#import "XLAlertView.h" ///alertView 宽 #define AlertW 280 ///各个栏目之间的距离 #define XLSpace 10.0 @interface XLAlertView() //弹窗 @property (nonatomic,retain) UIView *alertView; //title @property (nonatomic,retain) UILabel *titleLbl; //内容 @property (nonatomic,retain) UILabel *msgLbl; //确认按钮 @property (nonatomic,retain) UIButton *sureBtn; //取消按钮 @property (nonatomic,retain) UIButton *cancleBtn; //横线线 @property (nonatomic,retain) UIView *lineView; //竖线 @property (nonatomic,retain) UIView *verLineView; @end @implementation XLAlertView - (instancetype)initWithTitle:(NSString *)title message:(NSString *)message sureBtn:(NSString *)sureTitle cancleBtn:(NSString *)cancleTitle { if (self == [super init]) { self.frame = [UIScreen mainScreen].bounds; self.backgroundColor = [UIColor colorWithWhite:0.8 alpha:0.6]; self.alertView = [[UIView alloc] init]; self.alertView.backgroundColor = [UIColor whiteColor]; self.alertView.layer.cornerRadius = 5.0; self.alertView.frame = CGRectMake(0, 0, AlertW, 100); self.alertView.layer.position = self.center; if (title) { self.titleLbl = [self GetAdaptiveLable:CGRectMake(2*XLSpace, 2*XLSpace, AlertW-4*XLSpace, 20) AndText:title andIsTitle:YES]; self.titleLbl.textAlignment = NSTextAlignmentCenter; [self.alertView addSubview:self.titleLbl]; CGFloat titleW = self.titleLbl.bounds.size.width; CGFloat titleH = self.titleLbl.bounds.size.height; self.titleLbl.frame = CGRectMake((AlertW-titleW)/2, 2*XLSpace, titleW, titleH); } if (message) { self.msgLbl = [self GetAdaptiveLable:CGRectMake(XLSpace, CGRectGetMaxY(self.titleLbl.frame)+XLSpace, AlertW-2*XLSpace, 20) AndText:message andIsTitle:NO]; self.msgLbl.textAlignment = NSTextAlignmentCenter; [self.alertView addSubview:self.msgLbl]; CGFloat msgW = self.msgLbl.bounds.size.width; CGFloat msgH = self.msgLbl.bounds.size.height; self.msgLbl.frame = self.titleLbl"htmlcode">XLAlertView *xlAlertView = [[XLAlertView alloc] initWithTitle:@"自定义UIAlertView" message:@"不喜勿喷,大神多多指导。不胜感激" sureBtn:@"确认" cancleBtn:@"取消"]; xlAlertView.resultIndex = ^(NSInteger index){ //回调---处理一系列动作 }; [xlAlertView showXLAlertView];总结
以上就是这篇文章的全部内容了,希望本文的内容对各位iOS开发们能有所帮助,如果有疑问大家可以留言交流,谢谢大家对的支持。
无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com
暂无评论...
稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!
昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。
这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。
而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?
更新日志
2024年09月24日
2024年09月24日
- 陈随意2008-爱的总铺师[美华][WAV+CUE]
- 裘德《一棵树所创造的》[320K/MP3][56.21MB]
- 裘德《一棵树所创造的》[24bit 48kHz][FLAC/分轨][355.1MB]
- 卓依娜姆《美人谋 网剧影视原声带》[320K/MP3][48.29MB]
- 张星特.2024-流绪呢喃【中视鸣达】【FLAC分轨】
- 邓紫棋.2010-MYSECRET【蜂鸟音乐】【WAV+CUE】
- 江惠仪.2011-感謝您【禾广娱乐】【FLAC分轨】
- 韩红2005-精选[首版][WAV+CUE]
- 张敬轩.2004-A.M/P.M【几何文化】【WAV+CUE】
- 范文芳1999-真心话电影原声带[HYPE][WAV+CUE]
- 袁培华.1990-我写不出一首情歌给我最爱的你【可登】【WAV+CUE】
- 群星.2007-歌林10年流行岁月12CD【歌林】【WAV+CUE】
- 软硬天师.2006-LONG.TIME.NO.SEE【金牌大风】【WAV+CUE】
- 卓依娜姆《美人谋 网剧影视原声带》[FLAC/分轨][162.27MB]
- 国风大师纯音系列《蒋倩 :古筝演奏家》1CD[MP3][160.7MB]