aladinway / transitionbutton Goto Github PK
View Code? Open in Web Editor NEWUIButton sublass for loading and transition animation.
License: MIT License
UIButton sublass for loading and transition animation.
License: MIT License
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.
Getting "Message from debugger: Terminated due to memory issue" ios 11
When you put the secondVC (following the example) with a TabBarViewController its not working.
is it possible to show Right icon (✓ ) icon after activity indicator stops ?
Hi, I added TransitionButton in a project on Xcode 9 beta , when I open the project and run I get the following error in the code: Ambiguous reference to member 'asyncAfter(deadline:qos:flags:execute:)'
Hi,
Can you add Carthage support?
Thanks.
'kCAFillModeForwards' has been renamed to 'CAMediaTimingFillMode.forwards'
'kCAFillModeForwards' has been renamed to 'CAMediaTimingFillMode.forwards'
the app crashes
on line: let toView = transitionContext.view(forKey: .to)!
Fatal error: Unexpectedly found nil while unwrapping an Optional
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.
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()
}
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.
Loving the library! Only thing is, when using Auto Layout constraints, it appears as though the spinner completely miss-aligns like so:
https://i.imgur.com/K0o9vYi.png
Heres my constraints on the button in Interface Builder:
How to add the effect to a button inside tableview cell and action connected to uiviewcontroller..?
stopAnimation's completion
block is executed before .normal
and .shake
animations have completed
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
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?
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 ?
I want to set a new title for the button after loading finishes. But the text is reset to cached title.
Would it be a good idea to set the button to invisible instead of "" and revert to a visible button after ?
An example here : https://github.com/frodestorhaug/TransitionButton
btw thanks for a very nice framework 👍
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
})
})
})
})
}
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
}
Can't set layer.shadowOffset, color and opacity to TransitionButton.
Found one more bug.
If you stop loading button right after starting it, it will not revert to normal state.
Short description:
Can't build with error 'Objective-C module 'TransitionButton'
with compiler error 7 errors (Swift Compiler Error)
I tried your repo and it worked perfectly and I also tried
ReactiveX/RxSwift#728
but it also fail to work.
xcode version 10.0.0(10A255)
App is crashing is swift 4. Due to spinner colour.
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
after use StopAnimationStyle Shake then titlecolor error change to white :(
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.
'kCAFillModeForwards' has been renamed to 'CAMediaTimingFillMode.forwards'
'kCAFillModeForwards' has been renamed to 'CAMediaTimingFillMode.forwards'
I'm getting this error trying to integrate transition button to my project via pod.
I'm using pod 'TransitionButton' there's something wrong?
It's ok in cocoa pods website: https://cocoapods.org/pods/TransitionButton
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
Code crashes when you try to change spinner colour from code, while works fine when done from storyboard
My transition button title disappears after a few seconds I have tried by auto layout and programmatically too. Please help me if I am missing something
When you download trough Cocoapods its not downloading the last commit of Swift 4.2
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.
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:
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
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:
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
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.
Solved.
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:
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
Hi, is there any way for button in a table view cell to cover whole the view in controller when expand?
when i try to import transition button, getting this error
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.
when i want to import library
it says
"No such module 'TransitionButton' "
even in sample project !
Hi,
do you have any plan for updating?
thanks for this awesome library
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.