效果圖

demo.gif
依賴
代碼介紹(詳細(xì)使用,請(qǐng)參考 Demo)
例一
advertScrollViewCenter.titleColor = UIColor.green
advertScrollViewCenter.scrollTimeInterval = 5
advertScrollViewCenter.titles = ["京東、天貓等 app 首頁常見的廣告滾動(dòng)視圖", "采用代理設(shè)計(jì)模式進(jìn)行封裝, 可進(jìn)行事件點(diǎn)擊處理", "建議在 github 上下載"]
advertScrollViewCenter.titleFont = UIFont.systemFont(ofSize: 14)
advertScrollViewCenter.delegate = self
代理方法
func advertScrollView(advertScrollView: AdvertScrollView, index: NSInteger) {
print(index)
}
例二
advertScrollViewBottom.advertScrollViewStyle = AdvertScrollViewStyle.more
advertScrollViewBottom.topSignImages = ["dot", "dot", "dot"]
advertScrollViewBottom.topTitles = ["聚惠女王節(jié),香米更低價(jià)滿150減10", "HTC新品首發(fā),預(yù)約送大禮包", "“挑食”進(jìn)口生鮮,滿199減20"]
advertScrollViewBottom.bottomSignImages = ["dot", "dot", "dot"]
advertScrollViewBottom.bottomTitles = ["滿150減10+滿79減5", "12期免息+免費(fèi)試用", "領(lǐng)券滿199減20+進(jìn)口直達(dá)"]
注:非原創(chuàng),原作者是kingsic用Objective-C寫的,本人只是照著翻譯成Swift而已,非常感謝原作者允許公開,供大家參考
Swift版本demo下載鏈接:https://github.com/dongxiexidu/AdvertScollViewExample
Objective-Ct版本demo下載鏈接:https://github.com/kingsic/SGAdvertScrollView