示例
_pageControl = [[UIPageControl alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 15)];
_pageControl.numberOfPages = _pageCount;
_pageControl.hidesForSinglePage = YES;
[_pageControl addTarget:self action:@selector(pageControlNumberChanged:) forControlEvents:UIControlEventValueChanged];
當(dāng) _pageCount 設(shè)置為 2 時,
點擊 _pageControl,
方法 pageControlNumberChanged:內(nèi),
所獲取到的pageControl.currentPage,
會在 0 和 1 之間來回切換。
當(dāng)設(shè)置的數(shù)值大于 2 時,
則不會有這種情況。
一行代碼搞定視圖圓角
https://github.com/xjh093/JHViewCorner