Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ashfurrow/uiview-booleananimations
Perform changes to UI with or without animations, depending on a variable.
https://github.com/ashfurrow/uiview-booleananimations
Last synced: about 2 months ago
JSON representation
Perform changes to UI with or without animations, depending on a variable.
- Host: GitHub
- URL: https://github.com/ashfurrow/uiview-booleananimations
- Owner: ashfurrow
- License: mit
- Created: 2014-12-03T15:50:29.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-11-17T09:21:08.000Z (about 9 years ago)
- Last Synced: 2024-10-14T18:44:27.922Z (2 months ago)
- Language: Objective-C
- Size: 6.84 KB
- Stars: 47
- Watchers: 6
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
UIView-BooleanAnimations
========================Perform changes to UI with or without animations, depending on a variable.
Installation
------------Add the following to your Podfile.
```ruby
pod 'UIView+BooleanAnimations'
```Tun `pod install` and then use one of the following import statements, depending on if you're using frameworks and ObjC/Swift:
```objc
// With Framworks
@import UIView_BooleanAnimations;// With static libraries
#import
``````swift
// With Swift
import UIView_BooleanAnimations
```Use
---``` objc
@interface UIView (BooleanDependantAnimation)/// Optionally runs animations based on a bool, performs block right away if not true
+ (void)animateIf:(BOOL)shouldAnimate duration:(NSTimeInterval)duration :(void (^)(void))animations;/// Optionally runs animations based on a bool, performs animation + completion right away if not true
+ (void)animateIf:(BOOL)shouldAnimate duration:(NSTimeInterval)duration :(void (^)(void))animations completion:(void (^)(BOOL finished))completion;/// Only animates if shouldAnimate is true, otherwise will perform block synchronously with options
+ (void)animateIf:(BOOL)shouldAnimate duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options :(void (^)(void))animations;/// Only animates with delay and options if shouldAnimate is true, otherwise will perform block synchronously and perform completion in the same manner
+ (void)animateIf:(BOOL)shouldAnimate duration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options :(void (^)(void))animations completion:(void (^)(BOOL finished))completion;/// Optionally runs spring based animations based on a bool, performs animation right away if not true
+ (void)animateSpringIf:(BOOL)shouldAnimate duration:(NSTimeInterval)duration delay:(NSTimeInterval)delay damping:(CGFloat)damping velocity:(CGFloat)velocity :(void (^)(void))animations;/// Optionally runs spring based animations based on a bool, performs animation + completion right away if not true
+ (void)animateSpringIf:(BOOL)shouldAnimate duration:(NSTimeInterval)duration delay:(NSTimeInterval)delay damping:(CGFloat)damping velocity:(CGFloat)velocity :(void (^)(void))animations completion:(void (^)(BOOL finished))completion;// Adds a subview and fades it's alpha to 1, or adds the subview straight away
- (void)addSubview:(UIView *)view andFadeInForDuration:(CGFloat)duration if:(BOOL)shouldAnimate;// Fades a subview's alpha to 0 then removes, or syncronously removes the subview
- (void)removeFromSuperviewAndFadeOutWithDuration:(CGFloat)duration if:(BOOL)shouldAnimate;/// Useful for a fade animation
+ (void)animateTwoStepIf:(BOOL)shouldAnimate duration:(NSTimeInterval)duration :(void (^)(void))initialAnimations midway:(void (^)(void))midwayAnimations completion:(void (^)(BOOL finished))completion;@end
```