如何设置只layer.border色使用编程方式迅速
问题描述:
需要设置边框颜色为网页控制UIpage控制点或界面构建 边境不应设置完成页面控制 只需要申请边框颜色点。如何设置只layer.border色使用编程方式迅速
我知道有对UIcontrol没有层属性,它是页面控制
我想就加动态视图超类。
还是让我知道是否有任何其他可能的方式
答
使用如以下代码:
对(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;
}
}
我希望它可以帮助你。
您是否试过[this](http://stackoverflow.com/questions/2942636/how-can-i-change-the-color-of-pagination-dots-of-uipagecontrol)? – Lucas
是的,我试过这个 – viswateja
[this] [http://stackoverflow.com/questions/35842040/add-border-for-dots-in-uipagecontrol)? – Lucas