博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Alert
阅读量:7053 次
发布时间:2019-06-28

本文共 2275 字,大约阅读时间需要 7 分钟。

//响应

#pragma mark - UIActionSheetDelegate

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex

{

// the user clicked one of the OK/Cancel buttons

if (buttonIndex == 0)

{

NSLog(@"ok");

}

else

{

NSLog(@"cancel");

}

}

#pragma mark - UIAlertViewDelegate

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

{

// use "buttonIndex" to decide your action

//

}

 
Alert - 清雨小竹 - 清雨小竹
 

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"UIAlertView" message:@"<Alert message>"

                            delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];

    [alert show];

 

 

 

 

 

 

OKCancel形式

Alert - 清雨小竹 - 清雨小竹
 

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"UIAlertView" message:@"<Alert message>"

                            delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];

    [alert show];

 

 

 

 

 

 

button形式

Alert - 清雨小竹 - 清雨小竹
 

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"UIAlertView" message:@"<Alert message>"

                            delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Button1", @"Button2", nil];

    [alert show];

 

 

 

 

 

Alert - 清雨小竹 - 清雨小竹
 

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"UIActionSheet <title>"

                                    delegate:self cancelButtonTitle:nil destructiveButtonTitle:@"OK" otherButtonTitles:nil];

    actionSheet.actionSheetStyle = UIActionSheetStyleDefault;

    [actionSheet showInView:self.view]; // show from our table view (pops up in the middle of the table)

    [actionSheet release];

 

 

 

 

 

Alert - 清雨小竹 - 清雨小竹
 

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"UIActionSheet <title>"

                                    delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"OK" otherButtonTitles:nil];

    actionSheet.actionSheetStyle = UIActionSheetStyleDefault;

    [actionSheet showInView:self.view]; // show from our table view (pops up in the middle of the table)

    [actionSheet release];

 

 

 

 

Alert - 清雨小竹 - 清雨小竹
 

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"UIActionSheet <title>"

                                    delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil

                                    otherButtonTitles:@"Button1", @"Button2", nil];

    actionSheet.actionSheetStyle = UIActionSheetStyleDefault;

    actionSheet.destructiveButtonIndex = 1; // make the second button red (destructive)

    [actionSheet showInView:self.view]; // show from our table view (pops up in the middle of the table)

    [actionSheet release];

转载于:https://www.cnblogs.com/zzili/archive/2012/12/06/6663276.html

你可能感兴趣的文章
C# 实现保留两位小数的方法
查看>>
Http协议4个新的http状态码:428、429、431、511;
查看>>
C#类型简述
查看>>
Go:字符串操作
查看>>
EXCEL 2010学习笔记 —— VLOOKUP函数 嵌套 MATCH 函数
查看>>
android graphics: 2D animation
查看>>
升级 python 2.6.6 系统到 2.7.10 版本
查看>>
start with connect by prior 递归查询用法
查看>>
OS X 10.11 安装Cocoapods
查看>>
基于 HTML5 的工业互联网 3D 可视化应用
查看>>
洛谷——P1160 队列安排(链表的基础操作)
查看>>
MATLAB测试机器零阈值的大小
查看>>
单元格内文本显示超过单元格宽度的解决办法
查看>>
List遍历以及剔除指定数据
查看>>
[UIKit学习]06.懒加载,模型,自定义代码段,重写构造方法
查看>>
mv 批量
查看>>
require.js的AMD规范详解
查看>>
再转一篇gtest1.6安装
查看>>
sql Truncate 与 delete的区别
查看>>
linux case ${variable} in
查看>>