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.

  • 相关阅读:
    MSP430:输入捕获
    MSP430:串口输出
    测试输出时钟频率
    C# MySql Select
    C# MySql 连接
    MSP430:PWM产生
    MSP430:定时器学习TimerA
    MSP430:中断简介
    MSP430 PIN 操作寄存器
    剑指offer---包含min函数的栈
  • 原文地址:https://www.cnblogs.com/litaowei/p/3712025.html
Copyright © 2011-2022 走看看