//View 里面的一个按钮
- (IBAction)showAlert:(id)sender {
//ios8 之前
UIAlertView * alert=[[UIAlertView alloc]
initWithTitle:@"你好,波多老师"
message:@"听说您🈶有新戏要上映了"
delegate:nil
cancelButtonTitle:@"我来贡献票房来了"
otherButtonTitles:nil, nil
];
[alert show];
//IOS 8 之后
UIAlertController * newAlert=[UIAlertController
alertControllerWithTitle: @"你好,苍老师"
message:@"听说您也🈶有新戏要上映了"
preferredStyle:UIAlertControllerStyleAlert
];
UIAlertAction * newAlertAction=[UIAlertAction
actionWithTitle:@"我来贡献票房来了"
style:UIAlertActionStyleDefault
handler:nil
];
//弹框按钮
[newAlert addAction:newAlertAction];
//初始化弹框
[self presentViewController:newAlert animated:true completion:nil];
}