您的位置:首页 > 其它

Button按钮的使用和弹出对话框

2015-06-15 20:02 302 查看
//弹出对话框

    UIAlertView *alter=[[UIAlertView alloc] initWithTitle:@"第一次" message:@"第一次点击我" delegate:selfcancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
    [alter show];

按住control键并拖动button按钮到@implementation ViewController 下,可以自动生成代码



附代码:

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController
- (IBAction)btnclick:(id)sender {

    NSLog(@"已经点击我了");

    

    //弹出对话框

    UIAlertView *alter=[[UIAlertView alloc] initWithTitle:@"第一次" message:@"第一次点击我" delegate:selfcancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
    [alter show];
}

- (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.
}

@end
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: