代码改变世界

UIActionSheet(操作列表)

2015-06-30 22:28  甘雨路  阅读(162)  评论(0编辑  收藏  举报
 1 #import "AppDelegate.h"
 2 
 3 @interface AppDelegate ()<UIActionSheetDelegate>
 4 
 5 @end
 6 
 7 @implementation AppDelegate
 8 
 9 
10 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
11     self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
12     // Override point for customization after application launch.
13     self.window.backgroundColor = [UIColor whiteColor];
14     
15     UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"File Action" delegate:self cancelButtonTitle:@"cancel" destructiveButtonTitle:@"load" otherButtonTitles:@"save",@"Delete", nil];
16     [sheet showInView:self.window];
17     
18     
19     [self.window makeKeyAndVisible];
20     return YES;
21 }
22 
23 - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
24 {
25     NSLog(@"Button %ld is pressed...",buttonIndex);
26 }
27 
28 @end