1.UIAlertView概述
- 此前在提示框功能中有介绍到苹果自带的类可以实现弹窗的功能,这里的UIAlertView弹出效果如下:
2.UIAlertView基本使用
- UIAlertView在屏幕中央弹出
- UIAlertView可以添加文本输入框,可以实现登陆窗口功能
- 或者实现提示验证效果
这里我们实现点击屏幕,弹出弹框,点击按钮后弹框消失
代码实现:
// 触摸屏幕事件
-(void)touchesBegan:(nonnull NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event{
// 1.创建一个UIAlertView,可以在初始化的时候创建多个按钮
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示框" message:@"这是一个UIAlertView提示框" delegate:self cancelButtonTitle