DLRUIKit is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "DLRUIKit"
Nathan Walczak, [email protected]
DLRUIKit is available under the MIT license. See the LICENSE file for more info.
Normal State | Highlighted State | Disabled State |
---|---|---|
[self.veryNiceButton dlr_setBackgroundColor:[UIColor brownColor] forState:UIControlStateNormal];
[self.veryNiceButton dlr_setBackgroundColor:[UIColor blueColor] forState:UIControlStateHighlighted];
[self.veryNiceButton dlr_setBackgroundColor:[UIColor lightGrayColor] forState:UIControlStateDisabled];
[self.veryNiceButton dlr_applyRoundedCornersWithRadius:18.0f];
self.navyBlueView.backgroundColor = [UIColor dlr_colorWithRed:25 green:116 blue:210];
self.outrageousOrangeView.backgroundColor = [UIColor dlr_colorWithRed:255 green:110 blue:74];
self.purpleHeartView.backgroundColor = [UIColor dlr_colorWithRed:116 green:66 blue:200];
self.tumbleweedView.backgroundColor = [UIColor dlr_colorWithRed:222 green:170 blue:136];
self.unmellowYellowView.backgroundColor = [UIColor dlr_colorWithRed:255 green:255 blue:102 alpha:0.6f];
[self.navyBlueView dlr_applyRoundedCornersWithRadius:18.0f];
[self.outrageousOrangeView dlr_applyRoundedCornersWithRadius:18.0f];
[self.purpleHeartView dlr_applyRoundedCornersWithRadius:18.0f];
[self.tumbleweedView dlr_applyRoundedCornersWithRadius:18.0f];
[self.unmellowYellowView dlr_applyRoundedCornersWithRadius:18.0f];
Screen Shot | Storyboard |
---|---|
ChildViewController *childViewController = [ChildViewController dlr_instantiateViewController];
[childViewController dlr_addToParentViewController:self parentView:self.containerView];
[self.containerView dlr_applyRoundedCornersWithRadius:18.0f];
Create one category for each storyboard.
#import "DLRStoryboardManager+Main.h"
#import "ChildViewController.h"
static NSString * const kStoryboardName = @"Main"; // Main.storyboard
@implementation DLRStoryboardManager (Main)
+ (void)load {
[self registerStoryboardName:kStoryboardName
withStoryboardIdentifier:NSStringFromClass([ChildViewController class])];
}
@end
These categories can be generated.
bin/DLRStoryboardManager.sh DLRUIKitExampleApp/Main.storyboard
Lets instantiate a child view controller.
ChildViewController *childViewController = [ChildViewController dlr_instantiateViewController];
/** Returns true if current device has an idiom of pad. */
+ (BOOL)dlr_isUserInterfaceIdiomPad;
/** Returns true if the curent device system version is equal to version. */
+ (BOOL)dlr_isSystemVersionEqualToVersion:(NSString *)version;
/** Returns true if the curent device system version is greater than version. */
+ (BOOL)dlr_isSystemVersionGreaterThanVersion:(NSString *)version;
/** Returns true if the curent device system version is greater than or equal to version. */
+ (BOOL)dlr_isSystemVersionGreaterThanOrEqualToVersion:(NSString *)version;
/** Returns true if the curent device system version is less than version. */
+ (BOOL)dlr_isSystemVersionLessThanVersion:(NSString *)version;
/** Returns true if the curent device system version is less than or equal to version. */
+ (BOOL)dlr_isSystemVersionLessThanOrEqualToVersion:(NSString *)version;
/** Resets the constant back to the initial value after awake from nib. */
- (void)dlr_applyInitialConstant;
@property (weak, nonatomic) IBOutlet DLRLayoutConstraint *layoutConstraint;
// initial value of layoutConstraint.constant is 50
layoutConstraint.constant = -10;
// resets layoutConstraint.constant back to 50
[layoutConstraint dlr_applyInitialConstant];
/** Returns true if the passed view controller is the first view controller in the
stack of view controllers. This can be helpful in determining if the
view controller needed to be popped or dismissed. */
- (BOOL)dlr_isFirstViewController:(UIViewController *)viewController;
/** Returns a new navigation controller instance with this view controller as the
root view controller. */
- (UINavigationController *)dlr_embedInsideNavigationController;
/** Returns the top most presented view controller, which could be this view controller. */
- (UIViewController *)dlr_topPresentedViewController;