StatusFlow is an iOS implementation of a simple to use UICollectionView intended to show meaningful status that is animated and beautiful.
StatusFlow is a custom UICollectionView with a custom UICollectionViewFlowLayout.
It is intended to show incremental status, such that the "current" item is twice the size of other items in the collection view, is the selected item, and is centered horizontally and vertically within the view. The previous item is to the left of center and the next item is to the right. Other items are invisible and will fade in/fade out as the selected index is incremented. Although the setting of any selected index is supported, the control is intended to be used by incrementing or decrementing the selected index. Because it is a custom UICollectionView, any cell type is supported (although, most likely, your cell will just be a UIImageView). Since this is an informational control, user interaction is disabled. The typical mode is horizontal, but StatusFlow now supports vertical as well.
Via CocoaPods (preferred)
Use CocoaPods to add StatusFlow to your project.
- Add the StatusFlow pod to your podfile:
- Run pod install from your project folder to get the StatusFlow pod:
- Open your project in XCode using the workspace instead of the project file:
#import <StatusFlow/WDWStatusFlowView.h> to use StatusFlow
Via direct usage
Copy the following files into your workspace, or add them as a submodule:
Creating a StatusFlow
WDWStatusFlowView works very similar to using a UICollectionView. See the example in this project for a full project using StatusFlow.
- Use storyboards to create a storyboard for the view controller the has your StatusFlow in it. Drag a UICollectionView to your view controller. This will be the status flow.
- Set the Custom Class -> Class property of the storyboard to WDWStatusFlowView.
- Create an outlet from the StatusFlow to your view controller. This can be a private property.
- Create a cell class in XCode. It should inherit from UICollectionViewCell.
- Create the cell in the storyboard, and link it to the cell class using the Custom Class -> Class property.
- Make sure your UIViewController conforms to UICollectionViewDataSource and UICollectionViewDelegateFlowLayout (for collectionView:layout:sizeForItemAtIndexPath).
- In your ViewController's viewDidLoad method, use the WDWStatusFlowView's gapBetweenCells property to define the space between each cell. The default is 5.
- In your ViewController's viewDidLoad method, you can set the direction property on your StatusFlowView object to either WDWStatusFlowViewDirectionHorizontal or WDWStatusFlowViewDirectionVertical. It will be horizontal by default.
- Implement collectionView:numberOfItemsInSection. Note that there can only be ONE section.
- Implement collectionView:cellForItemAtIndexPath
- Implement collectionView:layout:sizeForItemAtIndexPath: to set the cell's size. The size of the cell is the size of the cell when it is NOT selected. It will double in size when selected. If your selected cell is larger than the collection view in width or height, it may not render properly.
- Increment or decrement the WDWStatusFlowView by incrementing or decrementing the selectedIndex property of the StatusFlowView. It is recommended that you only increment or decrement this value by one (although greater jumps are supported).
Using this repo
Your machine should have the following before you begin: ruby, ruby gems, bundler
To setup the project, run the included setup.sh. This will install required Gems and perform a pod install.
To open the project in Xcode run
$ open StatusFlow.xcworkspace
This project has been setup to use fastlane to run the tests.
$ bundle exec fastlane test
Version history can be found in the wiki
A tip of the crow to Ryan Baumbach for assistance with Travis ci.
Got a question, suggestion, comment, or guacamole recipe? firstname.lastname@example.org