Skip to content

Instantly share code, notes, and snippets.

@Andrewmika
Last active April 16, 2018 03:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Andrewmika/a966d99195ba29cdc5791b9babd810c5 to your computer and use it in GitHub Desktop.
Save Andrewmika/a966d99195ba29cdc5791b9babd810c5 to your computer and use it in GitHub Desktop.
自定义view设置内在大小
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