Last active
April 16, 2018 03:41
-
-
Save Andrewmika/a966d99195ba29cdc5791b9babd810c5 to your computer and use it in GitHub Desktop.
自定义view设置内在大小
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
static CGSize const kViewSize = {19, 19}; | |
- (void)layoutSubviews { | |
[super layoutSubviews]; | |
if (!CGSizeEqualToSize(self.bounds.size, [self intrinsicContentSize])) { | |
[self invalidateIntrinsicContentSize]; | |
} | |
} | |
- (CGSize)intrinsicContentSize { | |
return kViewSize; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment