A UIButton subclass that mimics the Follow button found in Instagram for iOS 7.
If you're using CocoaPods, simply add the following line to your Podfile:
pod 'MPSFollowButton'
Using MPSFollowButton is quite simple. All you need to do is create one, add it to your view and then toggle the different states.
For more an example, check out the example project included in this repository and file an issue if you run into any problems.
To toggle one of the states use one of the following methods on an instance of a MPSFollowButton.
- (void)setFollow;
- (void)setFollowWithText:(NSString *)titleLabelText;
- (void)setFollowing;
- (void)setFollowingWithText:(NSString *)titleLabelText;
- (void)setLoading;
- (void)setLoadingWithText:(NSString *)titleLabelText;
MPSFollowButton can be customized in several ways. You can customize the Button's Foreground and Background colors for both Normal and Selected states:
@property (nonatomic, strong) UIColor *followBackgroundColor;
@property (nonatomic, strong) UIColor *followingBackgroundColor;
@property (nonatomic, strong) UIColor *loadingBackgroundColor;
@property (nonatomic, strong) UIColor *followForegroundColor;
@property (nonatomic, strong) UIColor *followingForegroundColor;
@property (nonatomic, strong) UIColor *loadingForegroundColor;
Thanks to Instagram for the inspiration :)
- @strickland on Twitter
- @mps on Github
- [email protected]
- http://mstrick.com My Blog
See LICENSE.