Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Awesome BUT... #3

Open
loso921 opened this issue Jan 22, 2016 · 4 comments
Open

Awesome BUT... #3

loso921 opened this issue Jan 22, 2016 · 4 comments

Comments

@loso921
Copy link

loso921 commented Jan 22, 2016

I added the SAConfettiView.swift to my project manually but when i run it the screen freezes on me.. i have it setup in a segmented control so i only want the animation to show up in one of the 3 tabs in my segmented control. any idea?

@sudeepag
Copy link
Owner

sudeepag commented Mar 6, 2016

Do you call .startConfetti() in viewDidLoad() or in viewDidAppear()?

@lpaniccia
Copy link

I ran into an issue with a manual install as well. I'm getting an error:

fatal error: unexpectedly found nil while unwrapping an Optional value
on this line of SAConfettiView.swift
let bundle = NSBundle(path: path!)
I'm setting up and running confettiView in viewDidLoad()

@lpaniccia
Copy link

I figured out how to get around my issue. I had to manually copy the .png image files for confetti, triangle and diamond from the example project into my image folder, then comment out some of the code in the imageForType function and replace it with a way to look up the selected image from the image assets folder:

func imageForType(type: ConfettiType) -> UIImage? {

        var fileName: String!

        switch type {
        case .Confetti:
            fileName = "confetti"
        case .Triangle:
            fileName = "triangle"
        case .Star:
            fileName = "star"
        case .Diamond:
            fileName = "diamond"
        case let .Image(customImage):
            return customImage
        }

        /* Commenting out code for looking up image assets when installed with cocapods
        let path = NSBundle(forClass: SAConfettiView.self).pathForResource("SAConfettiView", ofType: "bundle")
        let bundle = NSBundle(path: path!)
        let imagePath = bundle?.pathForResource(fileName, ofType: "png")
        let url = NSURL(fileURLWithPath: imagePath!)
        let data = NSData(contentsOfURL: url)
        if let data = data {
            return UIImage(data: data)!
        }
        return nil
        */

        // Return the selected image from images folder
        return UIImage(named: fileName)

    }

@gesabo
Copy link

gesabo commented Jun 1, 2016

@lpaniccia thanks for adding this, same issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants