let containerViewWidth = 250
let containerViewHeight = 120
let containerFrame=CGRect(x: 10, y: 70, width: CGFloat(containerViewWidth), height: CGFloat(containerViewHeight))
let label=UILabel(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
label.text="anusha"
var containerView: UIView = UIView(frame: containerFrame);
containerView.addSubview(label)
alert.view.addSubview(containerView)
// now add some constraints to make sure that the alert resizes itself
let cons:NSLayoutConstraint = NSLayoutConstraint(item: alert.view, attribute: NSLayoutAttribute.height, relatedBy: NSLayoutRelation.greaterThanOrEqual, toItem: containerView, attribute: NSLayoutAttribute.height, multiplier: 1.00, constant: 130)
alert.view.addConstraint(cons)
var cons2:NSLayoutConstraint = NSLayoutConstraint(item: alert.view, attribute: NSLayoutAttribute.width, relatedBy: NSLayoutRelation.greaterThanOrEqual, toItem: containerView, attribute: NSLayoutAttribute.width, multiplier: 1.00, constant: 20)
alert.view.addConstraint(cons2)
alert.addAction(UIAlertAction(title: "Close", style: UIAlertActionStyle.default, handler: nil))
После того как я добавить вид .... кнопка закрытия не работает ... как сделать эту работу?IOS предупреждение вид контроллер
Бадди, и моя кнопка закрытия должна быть ниже контейнера. Просмотр ... что делать? –