当前位置: 首页 > news >正文

ios 对话框UIAlertController放 tableview

//强弱引用
#define kWeakSelf(type)__weak typeof(type)weak##type = type;
-(void) showUIAlertTable
{kWeakSelf(self)UIAlertController *alert = [UIAlertController      alertControllerWithTitle:NSLocalizedString(@"select_stu", nil)   message:nil   preferredStyle:UIAlertControllerStyleAlert];CGRect     frame = self.view.bounds;frame = CGRectInset(frame, 0, 0);UITableView *tableView2 = [[UITableView alloc] initWithFrame:frame style:UITableViewStylePlain];tableView2.dataSource = self;tableView2.delegate = self;[tableView2 registerClass:[DevicelistCell class] forCellReuseIdentifier:@"deviceCell"];[alert.view addSubview:tableView2];[self presentViewController:alert animated:NO completion:nil];}

在这里插入图片描述
问题来了,对话框 既然 不在屏幕中间。

解决办法

-(void) showUIAlertTable
{kWeakSelf(self)UIAlertController *alert = [UIAlertController      alertControllerWithTitle:NSLocalizedString(@"select_stu", nil)   message:nil   preferredStyle:UIAlertControllerStyleAlert];CGRect     frame = self.view.bounds;frame = CGRectInset(frame, -50, -300);UITableView *tableView2 = [[UITableView alloc] initWithFrame:frame style:UITableViewStylePlain];tableView2.dataSource = self;tableView2.delegate = self;[tableView2 registerClass:[DevicelistCell class] forCellReuseIdentifier:@"deviceCell"];[alert.view addSubview:tableView2];[self presentViewController:alert animated:NO completion:nil];}

frame = CGRectInset(frame, -50, -300);
根据各个手机去适配吧。调整到合适的位置。

http://www.lryc.cn/news/228980.html

相关文章:

  • 警告:新版Outlook会向微软发送密码、邮件和其他数据
  • 数据结构C语言--基础实验
  • wireshark抓包并进行Eigrp网络协议分析
  • 力扣刷题-二叉树-二叉树的层序遍历(相关题目总结)
  • fundamental notes in 3D math
  • 【Java 进阶篇】JQuery DOM操作:舞动网页的属性魔法
  • 腾讯云5年云服务器还有吗?腾讯云5年时长服务器入口在哪?
  • odoo在iot领域的发展情况
  • Paas-云原生-容器-编排-持续部署
  • sass 生成辅助色
  • DevEco Studio开发工具下载、安装(HarmonyOS开发)_For Mac
  • 按键精灵中的字符串常用的场景
  • python数据结构与算法-01_抽象数据类型和面向对象编程
  • 纯手写 模态框、消息弹框、呼吸灯
  • windows安装composer并更换国内镜像
  • c++ basic_string 和string区别
  • 怎么在uni-app中使用Vuex 简单demo,通俗易懂(第二篇)
  • 相机专业模型详解,各个参数作用,专业模式英文全称和缩写
  • 将随机数设成3407,让你的深度学习模型再涨一个点!文再附3种随机数设定方法
  • Spring后端HttpClient实现微信小程序登录
  • Linux下部署MySQL-MHA环境
  • DaoWiki(基于Django)开发笔记 20231114-阿里云mysql外部访问
  • 【UE5】 虚拟制片教程
  • 集成Line、Facebook、Twitter、Google、微信、QQ、微博、支付宝的三方登录sdk
  • 2022年09月 Python(五级)真题解析#中国电子学会#全国青少年软件编程等级考试
  • C. Number of Pairs
  • Js 保留关键字
  • nodejs+vue+python+PHP+微信小程序-安卓-房产中介管理信息系统的设计与实现-计算机毕业设计
  • 【系统架构设计】架构核心知识: 3.5 Redis和ORM
  • linux时间同步