如何使用Swift创建自定义警报?我尝试从Objective c翻译指南但加载全屏布局
为了方便我可以加载透明背景的新布局我试试这个:
listaalertviewcontroller.view.backgroundColor = UIColor.clearColor()
let purple = UIColor.purpleColor() // 1.0 alpha
let semi = purple.colorWithAlphaComponent(0.5)
listaalertviewcontroller.view.backgroundColor = semi
presentingViewController.modalPresentationStyle = UIModalPresentationStyle.CurrentContext
self.presentViewController(listaalertviewcontroller, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
在动画中它是透明的,但是当动画结束时它是不透明的......我在视图中关闭了不透明的选项......我做错了什么?
我想在iOS中显示一个对话框并添加UITextView到对话框的视图中.该UITextViewTextView的具有对电子邮件,电话和网址可点击的链接文字.我能够触发对话框,但只能使用标题和确定按钮.对话框视图中没有添加textview.我不确定这里的问题是文本视图还是视图添加到对话框的方式.
请检查下面的代码:
UITextView textView = new UITextView();
textView.Editable = false;
textView.DataDetectorTypes = UIDataDetectorType.All;
textView.Message = message;
var dlg = UIAlertController.Create(Title ?? String.Empty, null, UIAlertControllerStyle.Alert);
dlg.View.AddSubview(textView);
dlg.AddAction(UIAlertAction.Create(OkText, UIAlertActionStyle.Default, action => Submit()));
var top = Utils.GetTopViewController();
top.PresentViewController(dlg, animated: true, completionHandler: null);
Run Code Online (Sandbox Code Playgroud)
谢谢,