README.md in motion-kit-0.18.0 vs README.md in motion-kit-1.0.0
- old
+ new
@@ -1,13 +1,15 @@
# MotionKit
+[![Join the chat at https://gitter.im/motion-kit/motion-kit](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/motion-kit/motion-kit?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+
[![Build Status](https://travis-ci.org/motion-kit/motion-kit.svg?branch=master)](https://travis-ci.org/motion-kit/motion-kit)
[![Version](https://badge.fury.io/rb/motion-kit.svg)](https://rubygems.org/gems/motion-kit)
*The RubyMotion layout and styling gem.*
-1. Crossplatform compatibility: iOS, OSX, and planned support for Android
+1. Crossplatform compatibility: iOS, OSX, tvOS and planned support for Android
2. Simple, easy to learn DSL
3. Crossframework compatibility:
- [UIKit][readmore-uikit]
- [AppKit][readmore-appkit]
- [AutoLayout][readmore-autolayout]
@@ -856,9 +858,45 @@
@container_bottom.minus kbd_height # set @container_bottom.constant = 0 when the keyboard disappears
UIView.animateWithDuration(duration, delay: 0, options: curve, animations: -> do
self.view.layoutIfNeeded # applies the constraint change
end, completion: nil)
+```
+
+You can also activate/deactivate constraints selectively, and animate the
+transitions between them.
+
+```ruby
+class MyLayout < MK::Layout
+
+ def layout
+ add UIButton, :my_button do
+ constraints do
+ @top_constraint = top.equals(:superview, :bottom)
+ @bottom_constraint = bottom.equals(:superview).deactivate
+ left.equals(:superview)
+ right.equals(:superview)
+ height 48
+ end
+ end
+
+ def show_button
+ @top_constraint.deactivate
+ @bottom_constraint.activate
+ UIView.animateWithDuration(0.3, animations: -> do
+ self.view.layoutIfNeeded
+ end)
+ end
+
+ def hide_button
+ @bottom_constraint.deactivate
+ @top_constraint.activate
+ UIView.animateWithDuration(0.3, animations: -> do
+ self.view.layoutIfNeeded
+ end)
+ end
+
+end
```
### MotionKit::Events
gem install motion-kit-events