diff --git a/Example/SMPageControl/SMViewController.m b/Example/SMPageControl/SMViewController.m index d61dcbf..4e48aec 100644 --- a/Example/SMPageControl/SMViewController.m +++ b/Example/SMPageControl/SMViewController.m @@ -73,12 +73,12 @@ - (void)viewDidLoad - (void)pageControl:(id)sender { - NSLog(@"Current Page (UIPageControl) : %i", self.pageControl.currentPage); + NSLog(@"Current Page (UIPageControl) : %li", (long)self.pageControl.currentPage); } - (void)spacePageControl:(SMPageControl *)sender { - NSLog(@"Current Page (SMPageControl): %i", sender.currentPage); + NSLog(@"Current Page (SMPageControl): %li", (long)sender.currentPage); } @end diff --git a/SMPageControl.m b/SMPageControl.m index b0eb1fa..2099125 100755 --- a/SMPageControl.m +++ b/SMPageControl.m @@ -378,9 +378,10 @@ - (CGSize)sizeThatFits:(CGSize)size - (CGSize)intrinsicContentSize { if (_numberOfPages < 1 || (_numberOfPages < 2 && _hidesForSinglePage)) { - return CGSizeMake(UIViewNoIntrinsicMetric, 0.0f); + return CGSizeZero; } - CGSize intrinsicContentSize = CGSizeMake(UIViewNoIntrinsicMetric, MAX(_measuredIndicatorHeight, _minHeight)); + CGFloat intrinsicContentWidth = [self sizeForNumberOfPages:self.numberOfPages].width; + CGSize intrinsicContentSize = CGSizeMake(intrinsicContentWidth, MAX(_measuredIndicatorHeight, _minHeight)); return intrinsicContentSize; }