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.

  • 相关阅读:
    Python if __name__ == "__main__" 的含义
    自己用
    phpstorm && pycharm
    API Design for C++ 一本书值得一看
    std::set 使用
    Using Windows Web Services
    SOA 好好了解下
    NI Measurement Studio Enterprise 8.6
    那天看看
    内存映射 那天自己改改
  • 原文地址:https://www.cnblogs.com/litaowei/p/3712025.html
Copyright © 2011-2022 走看看