我们如何在UIAlertcontroller中将归属文本设置为消息.我的尝试代码如下,但它会崩溃的应用程序.
// create Attributed text
let myAttribute = [NSForegroundColorAttributeName: UIColor(red:122.0/255, green:125.0/255, blue:131.0/255, alpha:1.0),NSFontAttributeName: Constant.flinntRegularFont(15)]
let myAttribute2 = [NSForegroundColorAttributeName: UIColor.blackColor(),NSFontAttributeName: Constant.flinntMediumFont(15)]
let myString = NSMutableAttributedString(string: "You have been unsubscribed from ", attributes: myAttribute)
let myString2 = NSMutableAttributedString(string: self.course.course_name, attributes: myAttribute2)
let myString3 = NSMutableAttributedString(string: "\n\nYour refund will be initiated within one week.", attributes: myAttribute)
let myString4 = NSMutableAttributedString(string: "\n\nFor any help call us on", attributes: myAttribute)
let myString5 = NSMutableAttributedString(string: " 079-4014 9800", attributes: myAttribute2)
let myString6 = NSMutableAttributedString(string: " between …Run Code Online (Sandbox Code Playgroud) 我需要的东西看起来像UIAlertView(相同的背景透明而不是全屏),阻止其他UI部分,并有一些自定义内容.此自定义内容为:两个带标签的复选框和两个底部的YES/NO按钮.
子类或自定义UIAlertView看起来并不有用(请参阅此答案)并且它很危险(Apple可以拒绝代码).我正在考虑创建自己的自定义UIView(可能UIViewController),但我不知道如何让它看起来像UIAlertView.我的意思是我想让它改变它的外观依赖于iOS版本(iOS7).
更新:我可以放弃os版本依赖,它会很好,但这是附加功能.
主要的问题是:有没有一种很好的方法来制作这样的视图,它看起来和感觉像UIAlertView没有大量的工作?UIAlertView直接定制看起来既复杂又危险.