GithubHelp home page GithubHelp logo

aladinway / transitionbutton Goto Github PK

View Code? Open in Web Editor NEW
1.4K 24.0 155.0 1.33 MB

UIButton sublass for loading and transition animation.

License: MIT License

Ruby 10.79% Swift 89.21%
button transition loading animation ios swift cocoapods login expand shake

transitionbutton's People

Contributors

aladinway avatar cuzv avatar eil88 avatar j55blanchet avatar kenji21 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

transitionbutton's Issues

Bitcode Processing Failed

While processing your iOS app, errors occurred in the app thinning process, and your app couldn’t be thinned. If your app contains bitcode, bitcode processing may have failed. Because of these errors, this build of your app will not be able to be submitted for review or placed on the App Store.

CAMediaTimingFillMode rename

'kCAFillModeForwards' has been renamed to 'CAMediaTimingFillMode.forwards'

'kCAFillModeForwards' has been renamed to 'CAMediaTimingFillMode.forwards'

demo app crashes

  1. run the project
  2. tap on the first button
  3. tap on the <- button

the app crashes
on line: let toView = transitionContext.view(forKey: .to)!
Fatal error: Unexpectedly found nil while unwrapping an Optional

Update Podspec for Swift 4.2

for swift 4.2
pod 'TransitionButton', :git => 'https://github.com/AladinWay/TransitionButton.git' works

but just pod 'TransitionButton' doesn't work it pulls the last version not the master branch of the repo.

Ambiguous reference to member 'asyncAfter(deadline:qos:flags:execute:)'

Using the Xcode 9 and Swift 4, in the TransitionButton class, the following error occurs:

Ambiguous reference to member 'asyncAfter(deadline:qos:flags:execute:)'

The solution is to remove the timer in, so the functions should be something like this:

DispatchQueue.main.asyncAfter(deadline: .now() + delay) {
                self.setOriginalState()
                self.shakeAnimation()
            }

Expose init func

Here is my situation: After updated to 0.5.0, My TransitionButtonSubclass TransitionButton subclass cannot initialize by using let button = TransitionButtonSubclass(type: .system).

May I suggest you expose the init(frame: CGRect) function to make inherited class have the ability to initialize instance just like the version 0.4.0.

Usage in Tableviews

How to add the effect to a button inside tableview cell and action connected to uiviewcontroller..?

Warning when compiling

The following warning is displayed after building project:

Ld /Users/fidel/Library/Developer/Xcode/DerivedData/ProjectName-hebutnrxojkogvajrzazbwqyetri/Build/Intermediates.noindex/IBDesignables/Products/Debug-iphonesimulator/TransitionButton/TransitionButton.framework/TransitionButton normal x86_64 (in target: TransitionButton) cd /Users/fidel/Source/ios-contractor/ProjectName/Pods export IPHONEOS_DEPLOYMENT_TARGET=8.0 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk -L/Users/fidel/Library/Developer/Xcode/DerivedData/ProjectName-hebutnrxojkogvajrzazbwqyetri/Build/Intermediates.noindex/IBDesignables/Products/Debug-iphonesimulator/TransitionButton -F/Users/fidel/Library/Developer/Xcode/DerivedData/ProjectName-hebutnrxojkogvajrzazbwqyetri/Build/Intermediates.noindex/IBDesignables/Products/Debug-iphonesimulator/TransitionButton -filelist /Users/fidel/Library/Developer/Xcode/DerivedData/ProjectName-hebutnrxojkogvajrzazbwqyetri/Build/Intermediates.noindex/IBDesignables/Intermediates.noindex/Pods.build/Debug-iphonesimulator/TransitionButton.build/Objects-normal/x86_64/TransitionButton.LinkFileList -install_name @rpath/TransitionButton.framework/TransitionButton -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -Xlinker -rpath -Xlinker /Users/fidel/Library/Developer/Xcode/DerivedData/ProjectName-hebutnrxojkogvajrzazbwqyetri/Build/Intermediates.noindex/IBDesignables/Products/Debug-iphonesimulator/TransitionButton -mios-simulator-version-min=8.0 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/fidel/Library/Developer/Xcode/DerivedData/ProjectName-hebutnrxojkogvajrzazbwqyetri/Build/Intermediates.noindex/IBDesignables/Intermediates.noindex/Pods.build/Debug-iphonesimulator/TransitionButton.build/Objects-normal/x86_64/TransitionButton_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -Xlinker -add_ast_path -Xlinker /Users/fidel/Library/Developer/Xcode/DerivedData/ProjectName-hebutnrxojkogvajrzazbwqyetri/Build/Intermediates.noindex/IBDesignables/Intermediates.noindex/Pods.build/Debug-iphonesimulator/TransitionButton.build/Objects-normal/x86_64/TransitionButton.swiftmodule -framework UIKit -Wl,-pie -framework Foundation -framework UIKit -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/fidel/Library/Developer/Xcode/DerivedData/ProjectName-hebutnrxojkogvajrzazbwqyetri/Build/Intermediates.noindex/IBDesignables/Intermediates.noindex/Pods.build/Debug-iphonesimulator/TransitionButton.build/Objects-normal/x86_64/TransitionButton_dependency_info.dat -o /Users/fidel/Library/Developer/Xcode/DerivedData/ProjectName-hebutnrxojkogvajrzazbwqyetri/Build/Intermediates.noindex/IBDesignables/Products/Debug-iphonesimulator/TransitionButton/TransitionButton.framework/TransitionButton

ld: warning: -pie being ignored. It is only used when linking a main executable

Expand Animation

The expand animation does not seen to be executed at all, maybe it's too fast? All I can see is the expanded screen, can't see it growing, maybe add an option to change animation speed?

Navigation Controller transition

Hello, the transition animation not working well with Navigation controller ..
tried to present it like this but not working:

                          let storyboard = UIStoryboard(name: "Main", bundle: nil)
 let navController = storyboard.instantiateViewController(withIdentifier: "FinalBuy") 
 as!FinalBuyViewController
                            self.present(navController, animated: true, completion: nil)

the effect is now working but the navigation bar is not showing .. any solutions guys ?

animation inside completion block does not Animte

If I put an animation block inside the stop animation completion block, It does not animate anything. Here is a sample code:

@IBAction func redeemPPressed(_ sender: Any) {
        let button = sender as! TransitionButton
        button.startAnimation() // 2: Then start the animation when the user tap the button
        let qualityOfServiceClass = DispatchQoS.QoSClass.background
        let backgroundQueue = DispatchQueue.global(qos: qualityOfServiceClass)
        backgroundQueue.async(execute: {
            
            sleep(1) // 3: Do your networking task or background work here.
            
            DispatchQueue.main.async(execute: { () -> Void in
                // 4: Stop the animation, here you have three options for the `animationStyle` property:
                // .expand: useful when the task has been compeletd successfully and you want to expand the button and transit to another view controller in the completion callback
                // .shake: when you want to reflect to the user that the task did not complete successfly
                // .normal
                
                button.stopAnimation(animationStyle: .normal,revertAfterDelay: 1.0,completion: {
                    UIView.animate(withDuration: 1.0, animations: {
                        button.isHidden = true
                        self.codeView.isHidden = false
                    })
                })
            })
        })
    }

The button doesn't fill the full screen size

You can see at the image the size of the button once it finished it's stop animation.

2018-04-02 15 45 56

Here it's original layout:
2018-04-02 15 47 55

Is it me doing something wrong, or is it the problem with the library?

Crash on iOS 9

init(frame: CGRect) {
    super.init() 

    self.setToFrame(frame) // this line
    
    self.fillColor = nil
    self.strokeColor = spinnerColor.cgColor
    self.lineWidth = 1
    
    self.strokeEnd = 0.4
    self.isHidden = true
 }

Shadow

Can't set layer.shadowOffset, color and opacity to TransitionButton.

TransitionButton Crash when using with XIB

Hello,

First congratulations for the excellent library you created.

I'm having a problem and would like help, I'm using the TransitionButton on an XIB, and the app is crashing with the error below:

Basically I am adding a UIButton and changing its parent class to TransitionButton, I define my @IBOutlet with the type TransitionButton and when I try to access the button.spinnerColor or button.startAnimating () the app crashes with the error:

2017-09-22 11: 12: 18,978 Reserve [99333: 22192085] Unknown class _TtC7Reserve16TransitionButton in Interface Builder file.

Any idea?

Thanks a lot

clear titlecolor

after use StopAnimationStyle Shake then titlecolor error change to white :(

Button Expand animation choppy/not complete

Seems like the button is not covering the entire screen before transitioning or is just choppy. Not sure if I am just implementing wrong or an issue with the animation itself. Thanks.

CAMediaTimingFillMode rename

'kCAFillModeForwards' has been renamed to 'CAMediaTimingFillMode.forwards'

'kCAFillModeForwards' has been renamed to 'CAMediaTimingFillMode.forwards'

Issues with tabBarController

So I am trying to accomplish this but the setup of my app is a tabBarController which contains the main controllers not just a simple UIViewController. How would I make that work in that case

Spinner Color

Code crashes when you try to change spinner colour from code, while works fine when done from storyboard

Cocoapods fix

When you download trough Cocoapods its not downloading the last commit of Swift 4.2

CI build fails with error (misconfiguration)

Travis CI build fails with error,
the reason for it is not in erroneous library code, but due to misconfiguration.

For some reason, TransitionButton.framework is not being copied. On my local machine I've fixed this error by building library code with Carthage and manually importing the framework.

Problem with index when buttons are created programmatically

Hello!,

First of all, thank you for all the hard work. I've used this library in several projects and it's fantastic :D

I am running with a weird UI behavior thou... I have a view, where I need to create my buttons programmatically (because I don't know how many buttons do I need to have at first.)
I have a stack view where I add as categoriesStackView.addArrangedSubview(button) all the buttons, one by one.

It could end looking something like this:

UI end view

The method for creating each button is as follows:

  private func createCategoryButtons(categories: Results<Category>) {
        for category in categories {
            print(category.title)
            let button = createButtonFor(category: category)
            categoriesStackView.addArrangedSubview(button)
        }
    }

    private func createButtonFor(category: Category) -> CategoryButton {
        let button = CategoryButton()
        button.category = category
        button.spinnerColor = .white
        button.translatesAutoresizingMaskIntoConstraints = false
        button.heightAnchor.constraint(equalToConstant: 50).isActive = true
        button.isEnabled = true
        button.backgroundColor = Colors.secondaryPurple
        button.cornerRadius = 10
        button.setTitle(category.title, for: .normal)
        button.addTarget(self, action: #selector(launchTrivia(_:)), for: .touchUpInside)
        return button
    }

The order in where the buttons are created and added to the stack view is the same order that is shown in the picture. That is

  1. Sports
  2. General Knowledge
  3. History
  4. Geography

The problem is that if you click the second category: General Knowledge, the animation kicks in but you could see the "history" and "Geography" label in it, as the following image (this is a screenshot of the expand animation at the end:

UI Problem

Here you can see how the label are still visible (my thought is that it is because they are on top of the view) but the first category isn't shown as it was created before hence it is below in the index.

If you click on the third category: History, then Geography is the only label visible...

Do you happen to know how I can fix this?

Adding self.view.bringSubviewToFront(button) in the method called when the click target of the user in the button is trigger doesn't seem to work

    @objc func launchTrivia(_ button: CategoryButton) {
        self.view.bringSubviewToFront(button)
        button.startAnimation()
        Question.open(configuration: button.category) { (result) in
            switch result {
            case .failure(let error):
                print(error.localizedDescription)
                button.stopAnimation()
            case .success(let realm):
                button.stopAnimation(animationStyle: .expand, revertAfterDelay: 0) {
                    self.performSegue(withIdentifier: "play", sender: nil)
                }
            }
        }
        
    }

Thank you so much for your help

Best regards,

cornerRadius ignored coming back to the original state

cornerRadius property is not restored to user custom value when coming back to the original state (ie. stopping animation with shake).

I've fixed it by adding self.layer.cornerRadius = self.cornerRadius to the last line of setOriginalState() func.

private func setOriginalState() {
        self.animateToOriginalWidth()
        self.spiner.stopAnimation()
        self.setTitle(self.cachedTitle, for: .normal)
        self.setImage(self.cachedImage, for: .normal)
        self.isUserInteractionEnabled = true // enable again the user interaction
	self.layer.cornerRadius = self.cornerRadius
}

Hope you will add it to the main branch asap.
Have a nice day and thank you for your work.

How to i set animated Button Position to right instead of Center

First thanks for the great code...

I use TransitionButton at right side of Navigation Controller how ever button width bit bigger and on animation time that button become a rounded and take a position of center that looks wired for my UI. I have try a lot for find a way to make animation button position to right for ever but no luck. Can you please help

I have attached a screenshot bellowed:

img_4467
img_4466

Spinner not showing

When creating Button object I have given the frame .zero after that I am adding constraints programatically, In that case spinner is not showing. If I create Button with some frame then Spinner is visible but as per frame given not as per updated constraints

Corner radius won't return to original state

If you set button corner radius programmatically it won't return to its original state.

I suggest under setOriginalState method set

self.layer.cornerRadius = layer.cornerRadius instead of self.cornerRadius , this way it will go back to original state if you set programmatically or via storyboard.

import issue

when i want to import library
it says
"No such module 'TransitionButton' "

even in sample project !

Swift 5 Update

Hi,
do you have any plan for updating?
thanks for this awesome library

Issue with shadowed button

Hi, I really like to TransitionButton and i used it my previous projects :)

Now, I want to use it my new project but when I was add shadow to UIButton (TransitionButton) the animation is very laggy as you can see from below.. If I remove shadow, it's perfectly working.. How can I fix this?

ezgif com-video-to-gif

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.