GithubHelp home page GithubHelp logo

zacharykhan / zkcarousel Goto Github PK

View Code? Open in Web Editor NEW
288.0 288.0 57.0 1.56 MB

A simple carousel implementation written in Swift

License: MIT License

Ruby 9.28% Swift 90.72%
carousel collectionview ios swift xcode

zkcarousel's People

Contributors

alezoffoli avatar lpizzinidev avatar zacharykhan 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

zkcarousel's Issues

Swift 4 support

Hello,
First of all thank you for this useful lib. and Is there any chance of getting an updated version
for swift 4 ?, because I tried to import the actual version. It throws some errors, even though I can correct those by Xcode suggested remplacements. I prefer getting an official updated version :)

Thankyou.

App crash

attempt to scroll to invalid index path: <NSIndexPath: 0x2826f19e0> {length = 2, path = 0 - 1}

Please assist

Conflicting Constraint Errors

Hi,

I'm receiving the following message below when running the example app you provided.
Both natively as well as ingested within my app.
Also, it's important to note I updated my POD to the latest today and am running ZKCarousel (0.1.5) & (0.1.9)
I setup a symbolic breakpoint and discovered that the offending code is:
ZKCarousel.swift
extension UIView {

func addConstraintsWithFormat(_ format: String, views: UIView...) {

var viewsDictionary = [String: UIView]()
for (index, view) in views.enumerated() {
    let key = "v\(index)"
    viewsDictionary[key] = view
    view.translatesAutoresizingMaskIntoConstraints = false
}

**addConstraints(**NSLayoutConstraint.constraints(withVisualFormat: format, options: NSLayoutFormatOptions(), metrics: nil, views: viewsDictionary))

}
}

Also: setup(){
self.addConstraintsWithFormat("V:[v0(43)]-[v1]", views: self.titleLabel, self.descriptionLabel)
}

I've tested against an iPhone Xs Max and iPhone 6s plus
Error Below:
2018-10-04 14:44:23.392251-0400 ZKCarousel_Example[459:44964] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x2827c0a50 UILabel:0x105110440.bottom == UILabel:0x105118060.top + 8 (active)>",
"<NSLayoutConstraint:0x2827c12c0 V:[UILabel:0x105110440]-(NSSpace(8))-[UILabel:0x105118060] (active)>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x2827c12c0 V:[UILabel:0x105110440]-(NSSpace(8))-[UILabel:0x105118060] (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2018-10-04 14:44:24.892541-0400 ZKCarousel_Example[459:44964] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x2827d3520 UILabel:0x105215de0.bottom == UILabel:0x1052160d0.top + 8 (active)>",
"<NSLayoutConstraint:0x2827d3c00 V:[UILabel:0x105215de0]-(NSSpace(8))-[UILabel:0x1052160d0] (active)>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x2827d3c00 V:[UILabel:0x105215de0]-(NSSpace(8))-[UILabel:0x1052160d0] (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2018-10-04 14:44:25.076927-0400 ZKCarousel_Example[459:44964] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x2827c1680 UILabel:0x10510ddd0.bottom == UILabel:0x105104fa0.top + 8 (active)>",
"<NSLayoutConstraint:0x2827d32a0

Not working

I have added constraints to my view, but still receiving this issue. Is there any way to use it without constrains?

`2018-01-29 13:55:44.126069+0300 ARMPanel[40948:3156916] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSAutoresizingMaskLayoutConstraint:0x604000282a80 h=--& v=--& ZKCarousel.ZKCarousel:0x7ffbd1f1bfd0.width == 0 (active)>",
"<NSLayoutConstraint:0x60000009e550 H:|-(20)-[UIPageControl:0x7ffbd1f1cfa0] (active, names: '|':ZKCarousel.ZKCarousel:0x7ffbd1f1bfd0 )>",
"<NSLayoutConstraint:0x60000009e5a0 H:[UIPageControl:0x7ffbd1f1cfa0]-(20)-| (active, names: '|':ZKCarousel.ZKCarousel:0x7ffbd1f1bfd0 )>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x60000009e5a0 H:[UIPageControl:0x7ffbd1f1cfa0]-(20)-| (active, names: '|':ZKCarousel.ZKCarousel:0x7ffbd1f1bfd0 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2018-01-29 13:55:44.139670+0300 ARMPanel[40948:3156916] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x600000281f40 H:|-(15)-UILabel:0x7ffbd1d212f0'lorem ipsum devornum cora...' (active, names: '|':_TtC10ZKCarouselP33_624CA1E1E5D572C4565286BDA098607126carouselCollectionViewCell:0x7ffbd1e1eac0 )>",
"<NSLayoutConstraint:0x600000281f90 UILabel:0x7ffbd1d212f0'lorem ipsum devornum cora...'.right == _TtC10ZKCarouselP33_624CA1E1E5D572C4565286BDA098607126carouselCollectionViewCell:0x7ffbd1e1eac0.right - 15 (active)>",
"<NSLayoutConstraint:0x604000283520 'UIView-Encapsulated-Layout-Width' _TtC10ZKCarouselP33_624CA1E1E5D572C4565286BDA098607126carouselCollectionViewCell:0x7ffbd1e1eac0.width == 0 (active)>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x600000281f90 UILabel:0x7ffbd1d212f0'lorem ipsum devornum cora...'.right == _TtC10ZKCarouselP33_624CA1E1E5D572C4565286BDA098607126carouselCollectionViewCell:0x7ffbd1e1eac0.right - 15 (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2018-01-29 13:55:44.140534+0300 ARMPanel[40948:3156916] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x600000282170 H:|-(15)-[UILabel:0x7ffbd1e1ed40'A Demo Slide \U261d\Ud83c\Udffc'] (active, names: '|':_TtC10ZKCarouselP33_624CA1E1E5D572C4565286BDA098607126carouselCollectionViewCell:0x7ffbd1e1eac0 )>",
"<NSLayoutConstraint:0x6000002821c0 H:[UILabel:0x7ffbd1e1ed40'A Demo Slide \U261d\Ud83c\Udffc']-(15)-| (active, names: '|':_TtC10ZKCarouselP33_624CA1E1E5D572C4565286BDA098607126carouselCollectionViewCell:0x7ffbd1e1eac0 )>",
"<NSLayoutConstraint:0x604000283520 'UIView-Encapsulated-Layout-Width' _TtC10ZKCarouselP33_624CA1E1E5D572C4565286BDA098607126carouselCollectionViewCell:0x7ffbd1e1eac0.width == 0 (active)>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x6000002821c0 H:[UILabel:0x7ffbd1e1ed40'A Demo Slide โ˜๐Ÿผ']-(15)-| (active, names: '|':_TtC10ZKCarouselP33_624CA1E1E5D572C4565286BDA098607126carouselCollectionViewCell:0x7ffbd1e1eac0 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
`

Conflicting Constraint Errors

Hi,

  1. I'm receiving the following message below when running the example app you provided.
    Both natively as well as ingested within my app.
    Also, it's important to note I updated my POD to the latest today and am running ZKCarousel (0.1.5)
  2. I setup a symbolic breakpoint and discovered that the offending code is:

ZKCarousel.swift
extension UIView {

func **addConstraintsWithFormat**(_ format: String, views: UIView...) {
    
    var viewsDictionary = [String: UIView]()
    for (index, view) in views.enumerated() {
        let key = "v\(index)"
        viewsDictionary[key] = view
        view.translatesAutoresizingMaskIntoConstraints = false
    }
    
    **addConstraints(**NSLayoutConstraint.constraints(withVisualFormat: format, options: NSLayoutFormatOptions(), metrics: nil, views: viewsDictionary))
}

}

Also: setup(){
self.addConstraintsWithFormat("V:[v0(43)]-[v1]", views: self.titleLabel, self.descriptionLabel)
}

  1. I've tested against an iPhone Xs Max and iPhone 6s plus

Error Below:
2018-10-04 14:44:23.392251-0400 ZKCarousel_Example[459:44964] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x2827c0a50 UILabel:0x105110440.bottom == UILabel:0x105118060.top + 8 (active)>",
"<NSLayoutConstraint:0x2827c12c0 V:[UILabel:0x105110440]-(NSSpace(8))-[UILabel:0x105118060] (active)>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x2827c12c0 V:[UILabel:0x105110440]-(NSSpace(8))-[UILabel:0x105118060] (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2018-10-04 14:44:24.892541-0400 ZKCarousel_Example[459:44964] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x2827d3520 UILabel:0x105215de0.bottom == UILabel:0x1052160d0.top + 8 (active)>",
"<NSLayoutConstraint:0x2827d3c00 V:[UILabel:0x105215de0]-(NSSpace(8))-[UILabel:0x1052160d0] (active)>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x2827d3c00 V:[UILabel:0x105215de0]-(NSSpace(8))-[UILabel:0x1052160d0] (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2018-10-04 14:44:25.076927-0400 ZKCarousel_Example[459:44964] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x2827c1680 UILabel:0x10510ddd0.bottom == UILabel:0x105104fa0.top + 8 (active)>",
"<NSLayoutConstraint:0x2827d32a0

Adding tap gesture not working

Hello ! I want to add a tap gesture to go to a giving URL of the selected slide but when i add a tap gesture to the carousel view it doesn't work.

Autolayout issues with iphone8 and iphone8plus

Hi it seems i have a problem to set the carousel
self.carouselImageArr.frame = self.carousel.frame

When i load in iPhone8 it looks fine,
however when i load in iPhone8 Plus the carousel does not fill the view.

'use of undeclared ZKCarousel' error

Hi Sir, I installed this successfully using cocoapods but when I use it, it gives me this
'use of undeclared ZKCarousel' error. Why am I getting this?

screen shot 2018-06-04 at 10 41 07 am

Facing cell reusable issue in Collection view

HI,

I am using the ZKCarousel in a collection view. I am dequeresuing a collection view cell. The images are getting set from a URL array. if I scroll the collection view (fast) and the images are still downloading, the new collection view cell carousel is holding the image of the previous cell which is already loaded, and when the download completes it resets. I want to keep it blank till the image is downloading. Can you please suggest anything. Really really need help.

Thanks

Unable to simultaneously satisfy constraints.

Hi there, trying to use this pod programatically but getting

2019-08-14 01:23:26.888042-0700 xmppclient[49427:946242] [Graphics] UIColor created with component values far outside the expected range. Set a breakpoint on UIColorBreakForOutOfRangeColorComponents to debug. This message will only be logged once.
2019-08-14 01:23:27.097214-0700 xmppclient[49427:946242] [LayoutConstraints] Unable to simultaneously satisfy constraints.
	Probably at least one of the constraints in the following list is one you don't want. 
	Try this: 
		(1) look at each constraint and try to figure out which you don't expect; 
		(2) find the code that added the unwanted constraint or constraints and fix it. 
	(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x6000016944b0 h=--& v=--& ZKCarousel.ZKCarousel:0x7ffb12414960.width == 0   (active)>",
    "<NSLayoutConstraint:0x6000016aa990 H:|-(20)-[UIPageControl:0x7ffb12415a70](LTR)   (active, names: '|':ZKCarousel.ZKCarousel:0x7ffb12414960 )>",
    "<NSLayoutConstraint:0x6000016aa9e0 UIPageControl:0x7ffb12415a70.right == ZKCarousel.ZKCarousel:0x7ffb12414960.right - 20   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x6000016aa9e0 UIPageControl:0x7ffb12415a70.right == ZKCarousel.ZKCarousel:0x7ffb12414960.right - 20   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.

This is how I'm trying to use it https://github.com/andrewvmail/xmppclient/blob/ZKCarousel/xmppclient/ui/registration/WelcomePage/WelcomePageController.swift

Images rotate automatically

Hello!
Is there any property that causes the image to rotate automatically without the user touching the screen?

Tks,

Make UIImageView from ZKCarouselCell public

I was thinking on having access to the imageView to edit some of its properties. Specifically, I currently want to be able to change the contentMode to .scaleAspectFit. But more customization might be cool for the future.

We can make imageView public, or could also consider having some public methods to allow editing of some specific properties, but making the property public seems more flexible. What do you think?

Help With Async Image Loading

Im pretty sure this is to do with how I've implemented this, rather than the code itself but wasn't sure where else to ask. If its not the right place - sorry.

I drop ZKCarousel into several custom cells in a tableview and get the images using Alamofireimages library from my server. If I scroll quickly through my tableview the images in the ZKCarousel become mixed up or repeated. I'm pretty sure this is related to using dequeueReusableCell and things getting out of sync. Just wondered if you had any advice on how to avoid this problem?

Thanks
Chris

GestureRecognizer Action

By default it has the tap gesture that goes to the next image (slide) but is there a way in where i can change that action?

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.