//
// ViewController.m
//
// Created by dengw on 15/7/28.
// Copyright (c) 2015年 dengwei. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()<UIAlertViewDelegate,UIActionSheetDelegate>
- (IBAction)alertViewButton:(id)sender;
- (IBAction)actionSheetButton:(id)sender;
?
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (IBAction)alertViewButton:(id)sender {
????UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"Alert text goes here" delegate:self cancelButtonTitle:@"NO" otherButtonTitles:@"YES", nil];
????[alertView show];
}
?
#pragma mark? 实现UIAlertViewDelegate
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
????NSLog(@"buttonIndex = %li", buttonIndex);
}
- (IBAction)actionSheetButton:(id)sender {
????UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"破坏性按钮" otherButtonTitles:@"Facebook", @"新浪微博", nil];
????actionSheet.actionSheetStyle = UIActionSheetStyleAutomatic;
????[actionSheet showInView:self.view];
}
?
#pragma mark? 实现UIActionSheetDelegate
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
????NSLog(@"buttonIndex = %li", buttonIndex);
}
@end
用户登录
还没有账号?立即注册
用户注册
投稿取消
| 文章分类: |
|
还能输入300字
上传中....
没有猫也没有你99386891