您的位置:首页 > 其它

点击Button弹出警告表

2015-06-13 15:06 369 查看
按钮代码
UIButton *myButton = [UIButton buttonWithType:UIButtonTypeCustom];

[myButton setTitle:@"求最佳哦~" forState:UIControlStateNormal];

[myButton setTitle:@"可以松手~" forState:UIControlStateHighlighted];

[myButton addTarget:self action:@selector(myButton:) forControlEvents:UIControlEventTouchUpInside];

myButton.backgroundColor = [UIColor yellowColor];

myButton.bounds = CGRectMake(0, 0, 200, 100);

myButton.center = CGPointMake(self.view.frame.size.width/2, self.view.frame.size.height/2);

[self.view addSubview:myButton];

按钮响事件函数

-(void)myButton:(UIButton *)sender{

UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"按钮点击提示" delegate:self cancelButtonTitle:@"确定" otherButtonTitles: nil];

[myAlertView show];

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