不同颜色的CurrentPageIndicator彩色Swift Xcode

不同颜色的CurrentPageIndicator彩色Swift Xcode,xcode,swift,xcode6,uipagecontrol,Xcode,Swift,Xcode6,Uipagecontrol,是否有人建议更改每个不同页面的彩色currentPageIndicatorTintColor。类似这样的东西,但适用于ios手机 试试这个代码 这是用来改变点的颜色的 self.pageControl.pageIndicatorTintColor = UIColor.blackColor() 这用于根据页面索引使用不同的颜色更改当前页面点 if index == 0 { self.pageControl.currentPage = 1 self.pageControl.cur

是否有人建议更改每个不同页面的彩色currentPageIndicatorTintColor。类似这样的东西,但适用于ios手机

试试这个代码

这是用来改变点的颜色的

self.pageControl.pageIndicatorTintColor = UIColor.blackColor()
这用于根据页面索引使用不同的颜色更改当前页面点

if index == 0 {
    self.pageControl.currentPage = 1
    self.pageControl.currentPageIndicatorTintColor = UIColor.whiteColor()
} else if index == 1 {
    self.pageControl.currentPage = 2
    self.pageControl.currentPageIndicatorTintColor = UIColor.greenColor()
} else if index == 2 {
    self.pageControl.currentPage = 0
    self.pageControl.currentPageIndicatorTintColor = UIColor.redColor()
}
if index == 0 {
    self.pageControl.currentPage = 1
    self.pageControl.currentPageIndicatorTintColor = UIColor.whiteColor()
} else if index == 1 {
    self.pageControl.currentPage = 2
    self.pageControl.currentPageIndicatorTintColor = UIColor.greenColor()
} else if index == 2 {
    self.pageControl.currentPage = 0
    self.pageControl.currentPageIndicatorTintColor = UIColor.redColor()
}