We're sunsetting PodQuest on 2025-07-28. Thank you for your support!
Export Podcast Subscriptions
cover of episode 212. Changing constraints Demo

212. Changing constraints Demo

2015/11/29
logo of podcast iOSDevLog

iOSDevLog

Shownotes Transcript

override func traitCollectionDidChange(previousTraitCollection: UITraitCollection?) { /* Check the horizontal trait environment and adjust the layout accordingly. Only deactivate active constraints. */ if self.traitCollection.containsTraitsInCollection(UITraitCollection(horizontalSizeClass: UIUserInterfaceSizeClass.Compact)) { if regularConstraints[0].active { NSLayoutConstraint.deactivateConstraints(regularConstraints) NSLayoutConstraint.activateConstraints(compactConstraints) } } else { if compactConstraints[0].active { NSLayoutConstraint.deactivateConstraints(compactConstraints) NSLayoutConstraint.activateConstraints(regularConstraints) } } }