Skip to content

Commit

Permalink
Updated intrinsic height to match UIPageControl for which the height …
Browse files Browse the repository at this point in the history
…is zero when the control is hidden as a result of having only one or zero pages.
  • Loading branch information
idpaterson committed Oct 24, 2013
1 parent e4ca1b1 commit 757b6ca
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions SMPageControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,9 @@ - (CGSize)sizeThatFits:(CGSize)size

- (CGSize)intrinsicContentSize
{
if (_numberOfPages < 1 || (_numberOfPages < 2 && _hidesForSinglePage)) {
return CGSizeMake(UIViewNoIntrinsicMetric, 0.0f);
}
CGSize intrinsicContentSize = CGSizeMake(UIViewNoIntrinsicMetric, MAX(_measuredIndicatorHeight, _minHeight));
return intrinsicContentSize;
}
Expand Down Expand Up @@ -557,6 +560,7 @@ - (void)setNumberOfPages:(NSInteger)numberOfPages
self.accessibilityPageControl.numberOfPages = numberOfPages;

_numberOfPages = MAX(0, numberOfPages);
[self invalidateIntrinsicContentSize];
[self updateAccessibilityValue];
[self setNeedsDisplay];
}
Expand Down

0 comments on commit 757b6ca

Please sign in to comment.