iPhone控件之UIActionSheet

 1 //
2 // UITestViewController.m
3 // UITest
4 //
5
6 #import "UITestViewController.h"
7
8 @implementation UITestViewController
9
10 - (void)viewDidLoad {
11
12 [super viewDidLoad];
13
14 UIActionSheet *mySheet = [[UIActionSheet alloc] initWithTitle:@"Email Deletion Options"
15 delegate:self
16 cancelButtonTitle:@"Cancel"
17 destructiveButtonTitle:@"Delete Everything"
18 otherButtonTitles:@"All Read Email", @"Spam Only",nil];
19
20
21 mySheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;
22 [mySheet showInView:self.view];
23
24 [mySheet release];
25 }
26
27 - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
28
29 BOOL cancelClicked = actionSheet.cancelButtonIndex == buttonIndex;
30 BOOL destructiveButtonClicked = actionSheet.destructiveButtonIndex == buttonIndex;
31
32 NSLog(@"button with index %i clicked (cancel:%i, destructive:%i)",buttonIndex,cancelClicked,destructiveButtonClicked);
33
34 }
35
36 - (void)didReceiveMemoryWarning {
37 // Releases the view if it doesn't have a superview.
38 [super didReceiveMemoryWarning];
39
40 // Release any cached data, images, etc that aren't in use.
41 }
42
43 - (void)viewDidUnload {
44 // Release any retained subviews of the main view.
45 // e.g. self.myOutlet = nil;
46 }
47
48
49 - (void)dealloc {
50 [super dealloc];
51 }
52
53 @end

转载于:https://www.cnblogs.com/foxmin/archive/2012/03/13/2393599.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值