I have an UIButton which is a logo. This logo button will glow on forever but will stop glowing on touch.It is like a glowing animation.
Is there any suggestions?
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CABasicAnimation", referenced from:
objc-class-ref in UIView+Glow.o
"_OBJC_CLASS_$_CAMediaTimingFunction", referenced from:
objc-class-ref in UIView+Glow.o
"_kCAMediaTimingFunctionEaseInEaseOut", referenced from:
-[UIView(Glow) startGlowing] in UIView+Glow.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Here is my answer....
Using categories
Glowing code taken from: Creating a Glow Effect for UILabel and UIButton
First, you'll need to import the QuartzCore Framework:
When you create a button (or in
viewDidLoad
, depends on your code structure) add this code:You'll need to watch for two events:
UIControlEventTouchDown
andUIControlEventTouchUpInside
In
UIControlEventTouchDown
handler you'll add the code:And in
UIControlEventUpInside
handler you'll add the code:Again details of implementation depend on whether you create button programmaticaly or via Interface Builder but i'm sure you'll be able to figure this out from here on.
EDIT: for a custom button simply adding the following code should work:
I suggest you use the Glow Category of UIView made by secret lab.
Example is available here
Swift 4
1- Create UIView extension with the animation
2- Use it on textfields, buttons, views (any subclass of UIView)
Note: u may change values and play around to get the effect u need.
UIView extension
How to use it:
I like this glow + grow/shrink animation for my 'extra special' buttons: