zoukankan      html  css  js  c++  java
  • UIAlertView & UIActionSheet随笔笔记

    系统UIAlertView在很多地方有使用到,其创建的初始化的方法为:

    - (id)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id /*<UIAlertViewDelegate>*/)delegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ... 

    其中title、message 如上图所示;delegate是设置监听对象,通常设为self,也就是ViewController控制器为监听者,并遵循UIAlertViewDelegate协议,可使用协议中的clickedButtonAtIndex设置当点击了按钮后的实现内容;cancelButtonTitle为图中的“取消”,otherButtonTitle为图中的“确定”,按钮可以添加多个,所以...后还可以继续追加;

    - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;

    通过传入的buttonIndex获得用户点击的是哪个button;

    通过alertViewStyle的类型可以设置文本框样式;

    通过textFieldAtIndex:(NSInteger)textFieldIndex获得具体是哪个UITextField;

    最后通过show方法显示UIAlertView;

    UIActionSheet于UIAlertView类似,第一项按钮为红色提示,显示方法不是show而是 showInView.

  • 相关阅读:
    深入js——this
    深入js——作用域链
    深入js——变量对象
    深入js——执行上下文栈
    vue为什么不能检测数组的变化
    常用的文件下载方式
    vue中修改第三方组件的样式不生效
    Neo4j 学习笔记2
    Neo4j 学习笔记1
    idea git 命令
  • 原文地址:https://www.cnblogs.com/litaowei/p/3712025.html
Copyright © 2011-2022 走看看