在线直播系统源码,弹出警告/提示类弹窗

在线直播系统源码,弹出警告/提示类弹窗实现的相关代码

 

1
//<br>//  ViewController.m<br>//  001-UIAlertView<br>//<br>//  Created by lujun on 2021/6/3.<br>//<br>#import "ViewController.h"<br>@interface ViewController ()<br>- (IBAction)rightClick:(id)sender;<br>@end<br>@implementation ViewController<br>- (IBAction)clck2:(id)sender {<br>    <br>    <br>    <br>//    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"标题" message:@"消息" delegate:self cancelButtonTitle:@"取消按钮" otherButtonTitles:@"其他按钮标题", nil];<br>//<br>//    [alert show];<br>    <br>    //1.创建UIAlertControler<br>  <br>    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"标题" message:@"这是一些信息" preferredStyle:UIAlertControllerStyleAlert];<br>    /*<br>     参数说明:<br>     Title:弹框的标题<br>     message:弹框的消息内容<br>     preferredStyle:弹框样式:UIAlertControllerStyleAlert<br>     */<br>    <br>    //2.添加按钮动作<br>    //2.1 确认按钮<br>    UIAlertAction *conform = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {<br>        NSLog(@"点击了确认按钮");<br>    }];<br>    //2.2 取消按钮<br>    UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {<br>        NSLog(@"点击了取消按钮");<br>    }];<br>    //2.3 还可以添加文本框 通过 alert.textFields.firstObject 获得该文本框<br>//    [alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {<br>//       textField.placeholder = @"请填写您的反馈信息";<br>//  }];<br> <br>    //3.将动作按钮 添加到控制器中<br>    [alert addAction:conform];<br>    [alert addAction:cancel];<br>    <br>    //4.显示弹框<br>    [self presentViewController:alert animated:YES completion:nil];<br>    <br>    <br>}<br>- (IBAction)leftClick:(id)sender {<br>    <br>    <br>//    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"标题" message:@"消息" delegate:self cancelButtonTitle:@"取消按钮" otherButtonTitles:@"其他按钮标题", nil];<br>//<br>//    [alert show];<br>    <br>    //1.创建UIAlertControler<br>    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"标题" message:@"这是一些信息" preferredStyle:UIAlertControllerStyleAlert];<br>    /*<br>     参数说明:<br>     Title:弹框的标题<br>     message:弹框的消息内容<br>     preferredStyle:弹框样式:UIAlertControllerStyleAlert<br>     */<br>    <br>    //2.添加按钮动作<br>    //2.1 确认按钮<br>    UIAlertAction *conform = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {<br>        NSLog(@"点击了确认按钮");<br>    }];<br>    //2.2 取消按钮<br>    UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {<br>        NSLog(@"点击了取消按钮");<br>    }];<br>    //2.3 还可以添加文本框 通过 alert.textFields.firstObject 获得该文本框<br>    [alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {<br>       textField.placeholder = @"请填写您的反馈信息";<br>  }];<br> <br>    //3.将动作按钮 添加到控制器中<br>    [alert addAction:conform];<br>    [alert addAction:cancel];<br>    <br>    //4.显示弹框<br>    [self presentViewController:alert animated:YES completion:nil];<br>    <br>    <br>}<br>- (void)viewDidLoad {<br>    [super viewDidLoad];<br>    <br>}<br>- (IBAction)rightClick:(id)sender {<br>    //1.创建Controller<br>    UIAlertController *alertSheet = [UIAlertController alertControllerWithTitle:@"标题" message:@"一些信息" preferredStyle:UIAlertControllerStyleActionSheet];<br>    /*<br>     参数说明:<br>     Title:弹框的标题<br>     message:弹框的消息内容<br>     preferredStyle:弹框样式:UIAlertControllerStyleActionSheet<br>     */<br>    <br>    //2.添加按钮动作<br>    UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"项目1" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {<br>        NSLog(@"点击了项目1");<br>    }];<br>    UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"项目2" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {<br>        NSLog(@"点击了项目2");<br>    }];<br>    UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {<br>        NSLog(@"点击了取消");<br>    }];<br>    //3.添加动作<br>    [alertSheet addAction:action1];<br>    [alertSheet addAction:action2];<br>    [alertSheet addAction:cancel];<br>    <br>    //4.显示sheet<br>    [self presentViewController:alertSheet animated:YES completion:nil];<br>    <br>    <br>}<br>@end

以上就是在线直播系统源码,弹出警告/提示类弹窗实现的相关代码, 更多内容欢迎关注之后的文章

 

posted @   云豹科技-苏凌霄  阅读(149)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示