When developing for iOS 8.0 or later, just use isActive
property of NSLayoutConstraint
after creating your IBOutlet.
UPDATED
- to have strong reference to the outlet per below suggestion, thank you @rob mayoff.
- to use .isActive instead of .active with Swift 4 per below suggestion, thank you @Mohit Singh.
your cell would have the following outlet:
@IBOutlet var photoBottomConstraint: NSLayoutConstraint!
and you would access the constraint in willDisplayCell
like:
myCell.photoBottomConstraint.isActive = false
and when you need it again:
myCell.photoBottomConstraint.isActive = true
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…