• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

ZCycleView: 使用UICollectionView实现常见图片/文字无限轮播,支持自定义pageControl ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

ZCycleView

开源软件地址:

https://gitee.com/mengqingzheng/ZCycleView

开源软件介绍:

ZCycleView

A picture/text infinite-scroll library with UICollectionView, It can be very easy to help you make the banner you want

使用UICollectionView实现常见图片/文字无限轮播,支持自定义pageControl,自定义文字样式,以及轮播样式

image

How To

Basic usage

pretty easy to use,Basic usage like this

let cycleView = ZCycleView(frame: frame)cycleView.placeholderImage = UIImage(named: "placeholder")cycleView.setUrlsGroup(["http://...", "http://...", "http://..."], titlesGroup: ["...", "..."])view.addSubview(cycleView)

Set image or image url or text

you can also set the desc titlesGroup or attributedTitlesGroup, pick one of two, attributedTitlesGroup first

/// imagefunc setImagesGroup(_ imagesGroup: Array<UIImage?>, titlesGroup: [String?]? = nil, attributedTitlesGroup: [NSAttributedString?]? = nil)/// image urlfunc setUrlsGroup(_ urlsGroup: Array<String>, titlesGroup: [String?]? = nil, attributedTitlesGroup: [NSAttributedString?]? = nil)/// text onlyfunc setTitlesGroup(_ titlesGroup: Array<String?>?, attributedTitlesGroup: [NSAttributedString?]? = nil)

If you want the effect in the picture below, use the following method

Special reminder, be sure to set the size, otherwise the picture does not display

func setTitleImagesGroup(_ titleImagesGroup: [UIImage?], sizeGroup:[CGSize?])func setTitleImageUrlsGroup(_ titleImageUrlsGroup: [String?], sizeGroup:[CGSize?])

About item settings

/// The size of the item, the default cycleView sizevar itemSize: CGSize?/// The scale of the center itemvar itemZoomScale: CGFloat = 1/// The space of itemsvar itemSpacing: CGFloat = 0/// corner radiusvar itemCornerRadius: CGFloat = 0/// item borderColorvar itemBorderColor: UIColor = UIColor.clear/// item borderWidthvar itemBorderWidth: CGFloat = 0

E.g, Effect as shown below

cycleView.itemSize = CGSize(width: 240, height: 90)cycleView.itemZoomScale = 1.2

About desc settings

/// The height of the desc containerView, if you set the left image, is also includedvar titleViewHeight: CGFloat = 25/// titleAlignmentpublic var titleAlignment: NSTextAlignment = .left/// desc fontpublic var titleFont: UIFont = UIFont.systemFont(ofSize: 13)/// The backgroundColor of the desc containerViewpublic var titleBackgroundColor: UIColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.5)/// titleColorpublic var titleColor: UIColor = UIColor.white/// The number of lines of text displayedpublic var titleNumberOfLines = 1/// The breakMode of lines of text displayedpublic var titleLineBreakMode: NSLineBreakMode = .byWordWrapping

About pageControl settings

/// Whether to hide pageControl, the default `false`var pageControlIsHidden = false/// Dot color, the default `gray`var pageControlIndictirColor = UIColor.gray/// Current dot color, the default `white`var pageControlCurrentIndictirColor = UIColor.white/// The current dot imagevar pageControlCurrentIndictorImage: UIImage?/// The dot imagevar pageControlIndictorImage: UIImage?/// The height of pageControl, default `25`var pageControlHeight: CGFloat = 25/// PageControl's backgroundColorvar pageControlBackgroundColor = UIColor.clear/// The size of all dotsvar pageControlItemSize = CGSize(width: 8, height: 8)/// The size of current dotvar pageControlCurrentItemSize: CGSize?/// The space of dotvar pageControlSpacing: CGFloat = 8/// pageControl Alignment, left/right/center , default `center`var pageControlAlignment: ZCyclePageControlAlignment = .center/// the radius of dotvar pageControlItemRadius: CGFloat?/// the radius of current dotvar pageControlCurrentItemRadius: CGFloat?

didSelectedItem, didScrollToIndex

Click and scroll events are in the form of closures or delegate

/// scrollToIndexfunc cycleViewDidScrollToIndex(_ index: Int)/// selectedIndexfunc cycleViewDidSelectedIndex(_ index: Int)
/// clickvar didSelectedItem: ((Int)->())?/// scrollvar didScrollToIndex: ((Int)->())?

Other prototype

/// isAutomaticvar isAutomatic: Bool = true/// isInfinitevar isInfinite: Bool = true/// scroll timeIntervalvar timeInterval: Int = 2/// scrollDirectionvar scrollDirection: UICollectionViewScrollDirection = .horizontal/// placeholderImagevar placeholderImage: UIImage? = nil

dependency

Kingfisher

Contact

LICENSE

ZCycleView is released under the MIT license. See LICENSE for details.


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap