UIAlertView 基础篇

         属性

         title:标题

         message:内容

         numberOfButtons:获取按钮个数

         cancelButtonIndex:设置将某一个按钮设置为取消按钮

         firstOtherButtonIndex返回其他类型按钮第一个的索引值


         visible:警告框是否可见

         alertViewStyle:警告框模式 (UIAlertViewStyleDefault,UIAlertViewStyleSecureTextInput,UIAlertViewStylePlainTextInput,UIAlertViewStyleLoginAndPasswordInput)

         方法:

         - (instancetype)initWithTitle:(nullable NSString *)title message:(nullable NSString *)message delegate:(nullable id /*<UIAlertViewDelegate>*/)delegate cancelButtonTitle:(nullable NSString *)cancelButtonTitle otherButtonTitles:(nullable NSString *)otherButtonTitles;初始化方法,可以设置标题,内容,住按钮,和其他按钮

         - (id)initWithFrame:(CGRect)frame;设置位置大小

         - (NSInteger)addButtonWithTitle:(nullable NSString *)title;添加一个按钮并返回该按钮的索引

         - (nullable NSString *)buttonTitleAtIndex:(NSInteger)buttonIndex;根据按钮索引返回标题

         - (void)show;展示警告框

         - (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated;模拟点击按钮消失触发的方法

         - (nullable UITextField *)textFieldAtIndex:(NSInteger)textFieldIndex;设置文本框输入的索引

       代理方法

         - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;点击按钮时触发的方法

         - (void)alertViewCancel:(UIAlertView *)alertView;点击home键调用的方法

         - (void)willPresentAlertView:(UIAlertView *)alertView;将要展现警告框时触发的方法

         - (void)didPresentAlertView:(UIAlertView *)alertView ;警告框已经展示触发的方法
         - (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex;警告框将要消失触发的方法
         - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex;警告框已经消失触发的方法
         - (BOOL)alertViewShouldEnableFirstOtherButton:(UIAlertView *)alertView;设置是否允许第一个按钮不是取消按钮

          

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值