Ich hoffe, dass der Titel klar war. Ich möchte ein Element verstecken (Datenpicker in meinem Fall) und ich möchte auch seinen Platz verstecken. Also habe ich versucht, dies mit einer Animation:Swift, wie Element und seinen Raum zu verbergen
self.pickerQnt.hidden = true
aber nicht funktionieren:
@IBAction func showQnt(sender: AnyObject) {
if (self.pickerQnt.alpha == 0.0){
UIView.animateWithDuration(0.2, delay: 0.0, options: UIViewAnimationOptions.ShowHideTransitionViews, animations: {
self.pickerQnt.alpha = 1.0
}, completion: {
(finished: Bool) -> Void in
//var constH = NSLayoutConstraint(item: self.pickerQnt, attribute: NSLayoutAttribute.Height, relatedBy: NSLayoutRelation.Equal, toItem: nil, attribute: NSLayoutAttribute.NotAnAttribute, multiplier: 1, constant: 162)
//self.pickerQnt.addConstraint(constH)
})
} else {
UIView.animateWithDuration(0.2, delay: 0.0, options: UIViewAnimationOptions.ShowHideTransitionViews, animations: {
self.pickerQnt.alpha = 0.0
}, completion: {
(finished: Bool) -> Void in
// CHECK: ?!? constrain to set view height to 0 run time
//var constH = NSLayoutConstraint(item: self.pickerQnt, attribute: NSLayoutAttribute.Height, relatedBy: NSLayoutRelation.Equal, toItem: nil, attribute: NSLayoutAttribute.NotAnAttribute, multiplier: 1, constant: 0)
//self.pickerQnt.addConstraint(constH)
})
}
}
ich auch so etwas wie ausprobiert habe.
Vielen Dank im Voraus.
Gelöst, danke! –