swift UIAlertController使用 UIAlertController的宽度 为270
发布时间:2020-12-14 05:11:56 所属栏目:百科 来源:网络整理
导读:添加子控件 1. 有标题, alert标题高度大概 是 40, 子控件的 Y一般在40 ,如果中间有换行, n 的高度大概是30 2.alert的宽度 是270, 设置frame 的时候注意 /// nnn 多打几行 可以添加 空间高度 let alert = UIAlertController(title: "预约n信息nn
添加子控件 1. 有标题, alert标题高度大概 是 40, 子控件的 Y一般在40 ,如果中间有换行, n 的高度大概是30 2.alert的宽度 是270, 设置frame 的时候注意 /// nnn 多打几行 可以添加 空间高度 let alert = UIAlertController(title: "预约n信息nnn",message: "",preferredStyle: UIAlertControllerStyle.alert) /// 添加输入框 let textView = UITextView() textView.text = self.dataArr[row].remark textView.textColor = UIColor.black textView.backgroundColor = UIColor.red // textView.delegate = self textView.frame = CGRect(x: 10,y: 40 + 30,width: 250,height: 90) alert.view.addSubview(textView) //添加确定按钮 alert.addAction(UIAlertAction.init(title: "确定",style: UIAlertActionStyle.default,handler: { (_) in DDLOG(message: "点了确定 = (textView.text)") })) //添加取消按钮 alert.addAction(UIAlertAction.init(title: "取消",style: UIAlertActionStyle.cancel,handler: { (_) in DDLOG(message: "点了取消") })) self.present(alert,animated: true) { DDLOG(message: "添加完成") } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容