我有滾動視圖和pageContoll自定義視圖。Bug與設置currentPageIndicatorTintColor
let backScrollView = NSBundle.mainBundle().loadNibNamed("BackScrollView", owner: self, options: nil)[0] as! BackScrollView
我嘗試設置currentPageIndicatorTintColor
if brightnes > 200
{
backScrollView.pageControl.currentPageIndicatorTintColor = UIColor.blackColor()
}
else
{
backScrollView.pageControl.currentPageIndicatorTintColor = UIColor.whiteColor()
}
我運行在iPhone 5S(的iOS 9.2)這個代碼和代碼工作沒有問題,但是當我運行在iPhone 5(的iOS 8.4)這個代碼我成爲錯誤:
* Terminating app due to uncaught exception 'NSRangeException', reason: '* -[__NSArrayM objectAtIndex:]: index 4294967295 beyond bounds for empty array'
我知道錯誤是在這行代碼
backScrollView.pageControl.currentPageIndicatorTintColor = UIColor.blackColor()
我是通過使用print來計算的。
我做錯了什麼?
「我知道錯誤是在這行代碼」我不知道你知道。你能證明這個嗎? – matt