2016-06-15 24 views
0

需要設置邊框顏色爲網頁控制UIpage控制點或界面構建 邊境不應設置完成頁面控制 只需要申請邊框顏色點。如何設置只layer.border色使用編程方式迅速

我知道有對UIcontrol沒有層屬性,它是頁面控制

我想就加動態視圖超類。

還是讓我知道是否有任何其他可能的方式

+0

您是否試過[this](http://stackoverflow.com/questions/2942636/how-can-i-change-the-color-of-pagination-dots-of-uipagecontrol)? – Lucas

+0

是的,我試過這個 – viswateja

+0

[this] [http://stackoverflow.com/questions/35842040/add-border-for-dots-in-uipagecontrol)? – Lucas

回答

0

使用如以下代碼:

對(INT I = 0;我< _pageControl.numberOfPages;我++){

 UIView* dot = [_pageControl.subviews objectAtIndex:i]; 
     if (i == _pageControl.currentPage) { 
      dot.backgroundColor = [UIColor whiteColor]; 
      dot.layer.cornerRadius = dot.frame.size.height/2; 
     } else { 
      dot.backgroundColor = [UIColor clearColor]; 
      dot.layer.cornerRadius = dot.frame.size.height/2; 
      dot.layer.borderColor = [UIColor whiteColor].CGColor; 
      dot.layer.borderWidth = 1; 
     } 
    } 

我希望它可以幫助你。