Giter Site home page Giter Site logo

coder-tanjx / jxbanner Goto Github PK

View Code? Open in Web Editor NEW
600.0 600.0 78.0 11.63 MB

🚀🚀🚀 A super - custom multifunctional framework for banner unlimited rollover diagrams [一个超自定义多功能无限轮播图框架]

License: MIT License

Swift 96.92% Ruby 3.08%
banner cyclescrollview pageview

jxbanner's People

Contributors

coder-tanjx avatar mussacharles avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jxbanner's Issues

阿拉伯语适配

我看框架里面有写RTL的处理,但是,是滑动的时候,页面还是出现了问题,并且pageControl的方向也不对

iOS11系统,偶发闪退

func scrollToIndexPath(_ indexPath: IndexPath, animated: Bool) { }
方法内部调用collectionView滚动方法,在系统版本低的设备上会触发闪退的情况。
断点分析为collectionView未刷新完成,调用scrollToItem导致。
解决办法:
我尝试在滚动之前,判断要求滚动到的index是否合法,且滚动到的位置是否有item,可以解决闪退问题
添加的判断代码如下:
guard collectionView.numberOfItems(inSection: indexPath.section) > indexPath.row, let _ = collectionView.dataSource?.collectionView(collectionView, cellForItemAt: indexPath) else { return }

image

#2269839 SIGBUS

机型:iPhone Xr 系统版本14.4
JXPageControlScale里updateProgressyy12CoreGraphics7CGFloatVF + 1992 出现crash

libmecab.dylib
MeCab::TokenizerImpl<mecab_node_t, mecab_path_t>::lookup(char const*, char const*) + 340
19
UIKitCore
-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 660
20
CoreAutoLayout
0x0000000199050000 + 66844
21
UIKitCore
-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:] + 608
29
QuartzCore
CA::Transaction::commit() + 732

scroll mode isPagingEnabled

感谢作者的代码贡献

请问一下,
scrollView 模式想打开 isPagingEnabled,
但是需要靠左显示,不需要居中显示,应该如何设置呢?

unable to set current index

When reload data, we usually want to set an first display index.
seems like your code does not include that feature

偶现闪退

Thread 1: "Attempted to scroll the collection view to an out-of-bounds item (1000) when there are only 1 items in section 0. Collection view: <UICollectionView: 0x14b009e00; frame = (0 0; 362 655); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x2821c6c70>; layer = <CAGradientLayer: 0x283da90a0>; contentOffset: {0, 0}; contentSize: {362, 117.5}; adjustedContentInset: {0, 0, 0, 0}; layout: <JXBanner.JXBannerLayout: 0x14aa2c130>; dataSource: <JXBanner.JXBanner: 0x14aa2bd10; frame = (10 47.5; 362 655); tag = 10; layer = <CAGradientLayer: 0x283da8f00>>>."

//MARK: - override
override public func layoutSubviews() {
super.layoutSubviews()
if let itemSize = layout.params?.itemSize {
let x = (bounds.size.width - itemSize.width) * 0.5
let y = (bounds.size.height - itemSize.height) * 0.5
placeholderImgView.frame = CGRect(x: x, y: y, width: itemSize.width, height: itemSize.height)
}else {
placeholderImgView.frame = bounds
layout.params = layout.params
}
if pageCount > 0 {
scrollToIndexPath(currentIndexPath, animated: false)---------> 这里
}
}

JYPageControlScale指示器圆角可否外面控制

JYPageControlScale.swift

if isShowCorner {
if leftWidth > leftHeight {
leftLayer.cornerRadius = leftHeight0.5
}else {
leftLayer.cornerRadius = leftWidth
0.5
}
if rightWidth > rightHeight {
rightLayer.cornerRadius = rightHeight0.5
}else {
rightLayer.cornerRadius = rightWidth
0.5
}
}

how to setIndex manually in code

after pod JXBanner to my code , but i can't change the banner index manually in my code.
eg.
lazy var banner: JXBanner = {
let banner = JXBanner()
banner.backgroundColor = UIColor.clear
banner.delegate = self
banner.dataSource = self
return banner
}()

==========================
self.banner.setCurrentIndex(1) //it is coun't work

may i access property currentIndexPath to change?

thank you.

crash

#905062 SIGABRT
SocialGame refreshPageControl (JXBanner.swift: [Inline: pageControl.get])

image

显示异常

机型: iPhone 6
系统:11.2.1,12.5.5等
复现:基本功能使用,JXBanner(frame:), JXBannerCell。当只有1张图片时,cell向左偏移一半,仅显示右半部分。
多张图片则无此现象,其他机型也无此现象

fix reuse scrollToItem: to mask the bug of inaccurate scroll position,避免重复scrollToItem

避免重复scrollToItem
fix reuse scrollToItem: to mask the bug of inaccurate scroll position

collectionView.scrollToItem(at: indexPath,
                                        at: scrollPosition,
                                        animated: animated)
collectionView.scrollToItem(at: indexPath,
                                        at: scrollPosition,
                                        animated: animated)
func scrollToIndexPath(
        _ indexPath: IndexPath, animated: Bool) {
        
        if params.isPagingEnabled {
            
            let itemCount = collectionView.numberOfItems(inSection: indexPath.section)
            
            let itemWidth = layout.itemSize.width
            let itemHeight = layout.itemSize.height
            
            
            if layout.params?.scrollDirection == .vertical {
                let sectionSpacing = layout.sectionInset.left + layout.sectionInset.right
                let itemSpacing = layout.minimumLineSpacing

                let sectionHeight = CGFloat(indexPath.section) * (itemHeight + itemSpacing) * CGFloat(itemCount)
                let verticalOffset = sectionHeight + sectionSpacing / 2 + (itemHeight + itemSpacing) * CGFloat(indexPath.item) - collectionView.bounds.height / 2 + itemHeight / 2
                let offset = CGPoint(x: 0, y: verticalOffset)
                collectionView.setContentOffset(offset, animated: animated)
            }else {
                let sectionSpacing = layout.sectionInset.top + layout.sectionInset.bottom
                let itemSpacing = layout.minimumInteritemSpacing
                let sectionWidth = CGFloat(indexPath.section) * (itemWidth + itemSpacing) * CGFloat(itemCount)
                let horizontalOffset = sectionWidth + sectionSpacing / 2 + (itemWidth + itemSpacing) * CGFloat(indexPath.item) - collectionView.bounds.width / 2 + itemWidth / 2
                let offset = CGPoint(x: horizontalOffset, y: 0)
                collectionView.setContentOffset(offset, animated: animated)
            }
        }
    }

pageControl.indicatorSize 无效,activeSize,inactiveSize,indicatorSize都无效!

func jxBanner(pageControl banner: JXBannerType, numberOfPages: Int, coverView: UIView, builder: JXBannerPageControlBuilder) -> JXBannerPageControlBuilder { let pageControl = JXPageControlChameleon() pageControl.contentMode = .right let size = CGSize(width: 3, height: 3) pageControl.activeSize = size pageControl.indicatorSize = size pageControl.inactiveSize = size pageControl.activeColor = UIColor(red: 16, green: 142, blue: 233)! pageControl.inactiveColor = .white pageControl.columnSpacing = 6 pageControl.isAnimation = true builder.pageControl = pageControl builder.layout = { pageControl.snp.makeConstraints { (maker) in maker.left.right.equalTo(coverView).inset(10).priority(750) maker.bottom.equalTo(coverView.snp.bottom).inset(2) maker.height.equalTo(20) } } return builder }

collectiveView, willDisplay

Hi TanJX,
I am trying to add video instead of image into the cell but have a problem with func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath).
I cannot run this function. I added this function to JXBanner, JXBannerDelegate. I am trying to run video when the related cell visible.
Can you help me plz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.