@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.、
UIButton *button1 =[UIButton buttonWithType:UIButtonTypeInfoDark];
button1.frame = CGRectMake(175, 80, 40, 40);
UIButton *button2=[UIButton buttonWithType:UIButtonTypeRoundedRect];
button2.frame =CGRectMake(60, 180, 240, 44);
button2.backgroundColor= [UIColor purpleColor];
button2.tintColor = [UIColor yellowColor];
[button2 setTitle:@"tap my" forState:UIControlStateNormal];
[button2 addTarget:self action:@selector(buttonTap:) forControlEvents:UIControlEventTouchUpInside];
UIButton *button3 =[UIButton buttonWithType:UIButtonTypeRoundedRect];
button3.backgroundColor = [UIColor grayColor];
button3.tintColor = [UIColor whiteColor];
[button3 setTitle:@"tap me" forState:UIControlStateNormal];
button3.frame = CGRectMake(60, 280, 260, 44);
button3.layer.masksToBounds=YES;
button3.layer.cornerRadius=10;
button3.layer.borderWidth=4;
button3.layer.borderColor = [UIColor lightGrayColor].CGColor;
[self.view addSubview:button1];
[self.view addSubview:button2];
[self.view addSubview:button3];
}
-(void) buttonTap:(UIButton *)button
{
UIAlertController *alert= [UIAlertController alertControllerWithTitle:@"Info" message:@"click" preferredStyle:UIAlertControllerStyleAlert ];
UIAlertAction *okAction =[UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:nil];
[alert addAction:okAction];
[self presentViewController:alert animated:YES completion: nil];
}