Commit a3dba3f5 by Daniel Dahan

issue-140: fixed by treating animations as defaulted by UIView

parent 54a0341a
......@@ -40,9 +40,10 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
prepareFlatButtonExample()
prepareRaisedButtonExample()
prepareFabButtonExample()
// prepareFlatButtonExample()
// prepareRaisedButtonExample()
// prepareFabButtonExample()
prepareFabButtonAnimationExample()
}
/// General preparation statements.
......@@ -80,5 +81,24 @@ class ViewController: UIViewController {
// Add button to UIViewController.
view.addSubview(button)
}
/// Prepares the FabButton animation example.
private func prepareFabButtonAnimationExample() {
let img: UIImage? = UIImage(named: "ic_create_white")
let button: FabButton = FabButton(frame: CGRectMake(175, 315, 64, 64))
button.setImage(img, forState: .Normal)
button.setImage(img, forState: .Highlighted)
// Add button to UIViewController.
view.addSubview(button)
UIView.animateWithDuration(0.4,
delay: 3,
usingSpringWithDamping: 0.6,
initialSpringVelocity: 0,
options: .AllowUserInteraction, animations: {
button.frame.origin.x = 300
}, completion: nil)
}
}
Pod::Spec.new do |s|
s.name = 'Material'
s.version = '1.29.1'
s.version = '1.29.2'
s.license = 'BSD'
s.summary = 'A beautiful graphics framework for Material Design in Swift.'
s.homepage = 'http://cosmicmind.io'
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.29.1</string>
<string>1.29.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
......@@ -466,13 +466,6 @@ public class MaterialButton : UIButton {
}
/**
:name: actionForLayer
*/
public override func actionForLayer(layer: CALayer, forKey event: String) -> CAAction? {
return nil // returning nil enables the animations for the layer property that are normally disabled.
}
/**
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method
to initialize property values and other setup operations.
......
......@@ -347,16 +347,6 @@ public class MaterialView : UIView {
}
/**
By default CALayer values are animated. The UIView class supresses this
behavior for its backing layer. By overrinding the actionForLayer method
and returning nil, the backing layer's default animation behavior
is enabled.
*/
public override func actionForLayer(layer: CALayer, forKey event: String) -> CAAction? {
return nil
}
/**
A method that accepts CAAnimation objects and executes them on the
view's backing layer.
- Parameter animation: A CAAnimation instance.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment