alert 就是弹窗,但是用好了可以发挥很大作用啊,如下是一个简单到使用alert到程序:
一起学习下:
AssertViewController.h
// AssertViewController.h
// Assert
//
// Created by poleness on 14-5-15.
// Copyright (c) 2014年 ___FULLUSERNAME___. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AssertViewController : UIViewController
@end
AssertViewController.m
//
// AssertViewController.m
// Assert
//
// Created by poleness on 14-5-15.
// Copyright (c) 2014年 ___FULLUSERNAME___. All rights reserved.
//
#import "AssertViewController.h"
@interface AssertViewController ()
- (IBAction)aessertName:(id)sender;
@end
@implementation AssertViewController
- (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)aessertName:(id)sender {
UIAlertView *alert =[[UIAlertView alloc] initWithTitle:@"propose marriage"
message:@"Will U marry Me?"
delegate:nil
cancelButtonTitle:@"No"
otherButtonTitles:@"okey", nil];
[alert show];
}
@end
这只是简单的使用,编译后截图如下:
iOS学习ing,感谢老鱼,感谢geekhead