@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(IBAction)alert{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示框" message:@"测试提示框" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"好", nil];
//有三种风格
[alertView setAlertViewStyle:UIAlertViewStylePlainTextInput];
[alertView show];
}
#pragma mark -
#pragma UIAlertViewDelegate
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger) buttonIndex{
UITextField *text = [alertView textFieldAtIndex:0];
NSLog(@"输出=%@",text.text);
}
#pragma mark
@end