使用swift實現的簡單易用的無限循環滾動:DDCycleScrollView
使用swift實現的簡單易用的無限循環滾動
已實現以下功能
- 使用三個UIImageView實現的循環滾動
- 自動輪播,可做廣告輪播
- 本demo中數據返回類型為String類型,但是可以根據自己的業務需要更改為其他的數據類型
- 如果需要其他自定的UIView,可以把DDCycleScrollView.swift文件中的三個UIImageView更改為需要的自定義UIView
- 本人第一次在gitHub上上傳代碼,希望大家多多鼓勵 </ul>
- 遵守協議 </ul>
- 創建 </ul>
使用方法
class ViewController: UIViewController,DDCycleScrollViewDelegate
var cycleScrollView = DDCycleScrollView(frame: CGRectMake((view.frame.width - 250)/2, 64, 250, 300)) cycleScrollView.backgroundColor = UIColor.blueColor() cycleScrollView.delegate = self view.addSubview(cycleScrollView)
實現協議方法
func numberOfPages() -> Int {return imageArray.count; } func currentPageViewIndex(index: Int) -> String { return imageArray[index] } func didSelectCurrentPage(index: Int) { println("\(index)") }</pre><br />
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!