在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:HKCycleViewSwift开源软件地址:https://gitee.com/Steven_Hu/HKCycleViewSwift开源软件介绍:HKCycleViewSwiftExampleTo run the example project, clone the repo, and run import UIKitimport HKCycleViewSwiftclass 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)个") }} 效果图RequirementsInstallationHKCycleViewSwift is available through CocoaPods. To installit, simply add the following line to your Podfile: #轮播组件pod 'HKCycleViewSwift', :git => 'https://gitee.com/Steven_Hu/HKCycleViewSwift.git' AuthorHJT916109796, [email protected] LicenseHKCycleViewSwift is available under the MIT license. See the LICENSE file for more info. |
请发表评论