3 Star 5 Fork 2

StevenHu / HKCycleViewSwift

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

HKCycleViewSwift

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

import UIKit
import HKCycleViewSwift
class BCBannerCell: UICollectionViewCell,UICollectionViewDelegate {
    lazy var cycleView: HKCycleView = {
        let view:HKCycleView = HKCycleView()
        let images:[UIImage] = [R.image.pic1() ?? UIImage(),R.image.pic2()  ?? UIImage(),R.image.pic3() ?? UIImage(),R.image.pic4() ?? UIImage()]
        view.setUrlsGroup(["http://chatm-icon.oss-cn-beijing.aliyuncs.com/pic/pic_20171101181927887.jpg", "http://chatm-icon.oss-cn-beijing.aliyuncs.com/pic/pic_20171114171645011.jpg", "http://chatm-icon.oss-cn-beijing.aliyuncs.com/pic/pic_20171114172009707.png"])
        view.setImagesGroup(images, titlesGroup: ["天天特价 -- 超值量贩,底价疯抢天天特价","一缕情丝,一缕温暖","快速匹配,及时推送","气质春装,一件包邮"])
        view.itemSize = CGSize(width: BC_SCREEN_WIDTH-80, height: (BC_SCREEN_WIDTH-80)*360/750)
        view.itemSpacing = 30
        view.itemZoomScale = 1.1
        view.itemCornerRadius = 10
        view.pageControlItemSize = CGSize.zero
        view.backgroundColor = UIColor.white
        view.delegate = self
        return view
    }()
    
    override func layoutSubviews() {
        super.layoutSubviews()
        self.addSubview(cycleView)
        cycleView.frame = CGRect(x: 0, y: 0, width: BCBannerCell.itemHeight().width, height: BCBannerCell.itemHeight().height)
    }
    
    public static func itemHeight() -> CGSize {
        return CGSize(width: BC_SCREEN_WIDTH, height: 360.scale)
    }
    
    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
        
    }
}
//代理方法
extension UICollectionViewCell: HKCycleViewProtocol {
    public func hk_cycleViewDidScrollToIndex(_ index: Int) {
        
    }
    public func hk_cycleViewDidSelectedIndex(_ index: Int) {
        BCKeyWindow?.bc_showToast("你点击了第 \(index)个")
    }
}

效果图

轮播-有文字-Swift 轮播-没有文字-Swift

Requirements

Installation

HKCycleViewSwift is available through CocoaPods. To install it, simply add the following line to your Podfile:

#轮播组件
pod 'HKCycleViewSwift', :git => 'https://gitee.com/Steven_Hu/HKCycleViewSwift.git'

Author

HJT916109796, hujintao@hezi.com

License

HKCycleViewSwift is available under the MIT license. See the LICENSE file for more info.

Copyright (c) 2019 HJT916109796 <hujintao@hezi.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Swift语言,轮播图组件,可复用性强: 展开 收起
Swift 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Swift
1
https://gitee.com/Steven_Hu/HKCycleViewSwift.git
git@gitee.com:Steven_Hu/HKCycleViewSwift.git
Steven_Hu
HKCycleViewSwift
HKCycleViewSwift
master

搜索帮助