Created
August 8, 2013 18:12
-
-
Save tibr/6187127 to your computer and use it in GitHub Desktop.
UIScrollView needs a subview with an absolute width value to use it's full width as contentSize. I'm trying to use a helper view here to make sure it always uses it's own width as it's content width. https://developer.apple.com/library/ios/#releasenotes/General/RN-iOSSDK-6_0/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIView *scrollViewWidthEnforcer = [UIView new]; | |
[scrollViewWidthEnforcer setTranslatesAutoresizingMaskIntoConstraints:NO]; | |
[self.scrollView addSubview:scrollViewWidthEnforcer]; | |
[self.scrollView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[enforcer(==scrollView)]|" | |
options:0 | |
metrics:nil | |
views:@{ | |
@"enforcer" : scrollViewWidthEnforcer, | |
@"scrollView" : self.scrollView | |
}]]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment