问题描述
UIAlertController 的标题出现,但 UIAlertAction 按钮不只出现在 iPhone 6s 中。请帮我解决这个问题。
以下是我尝试过的代码:
datePicker.frame = CGRect(x: 0,y: 50,width: 270,height: 230)
let alertController = UIAlertController(title: dateSelection == DateSelection.FROM_DATE_SELECTION ? "Select date" : "To Date",message: "\n\n\n\n\n\n\n\n",preferredStyle: .alert)
let selectAction = UIAlertAction(title: "Ok",style: .default,handler: { _ in
self.prepareDates(selectedDate: self.datePicker.date,dateSelection: dateSelection)
})
let cancelAction = UIAlertAction(title: "Cancel",style: .cancel,handler: nil)
alertController.view.setNeedsLayout()
alertController.view.addSubview(datePicker)
alertController.addAction(selectAction)
alertController.addAction(cancelAction)
let height: NSLayoutConstraint = NSLayoutConstraint(item: alertController.view!,attribute: NSLayoutConstraint.Attribute.height,relatedBy: NSLayoutConstraint.Relation.equal,toItem: nil,attribute: NSLayoutConstraint.Attribute.notAnAttribute,multiplier: 1,constant: self.view.frame.height * 0.40)
alertController.view.addConstraint(height);
present(alertController,animated: true)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)