Latest 1.4.0
Homepage https://github.com/detroit-labs/dlr-uikit-ios
License MIT
Platforms ios , requires ARC
Authors

CI Status
Version
License
Platform

Installation

DLRUIKit is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "DLRUIKit"

Author

Nathan Walczak, [email protected]

License

DLRUIKit is available under the MIT license. See the LICENSE file for more info.

Examples

UIButton Category Examples

Normal State Highlighted State Disabled State
UIButton normal UIButton highlighted UIButton disabled
UIButton dlr_setBackgroundColor: forState:
[self.veryNiceButton dlr_setBackgroundColor:[UIColor brownColor] forState:UIControlStateNormal];
[self.veryNiceButton dlr_setBackgroundColor:[UIColor blueColor] forState:UIControlStateHighlighted];
[self.veryNiceButton dlr_setBackgroundColor:[UIColor lightGrayColor] forState:UIControlStateDisabled];
UIView dlr_applyRoundedCornersWithRadius:
[self.veryNiceButton dlr_applyRoundedCornersWithRadius:18.0f];

UIColor Category Examples

UIColor

UIColor dlr_colorWithRed: green: blue:
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];
UIView dlr_applyRoundedCornersWithRadius:
[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];

UIViewController+DLRParentViewController Category Examples

Screen Shot Storyboard
DLRParentViewController DLRParentViewController storyboard
UIViewController dlr_instantiateViewController
ChildViewController *childViewController = [ChildViewController dlr_instantiateViewController];
UIViewController dlr_addToParentViewController:
[childViewController dlr_addToParentViewController:self parentView:self.containerView];
UIView dlr_applyRoundedCornersWithRadius:
[self.containerView dlr_applyRoundedCornersWithRadius:18.0f];

UIViewController+DLRStoryboardManager Category Examples

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];

UIDevice Category Examples

User Interface Idiom
/** Returns true if current device has an idiom of pad. */
+ (BOOL)dlr_isUserInterfaceIdiomPad;
System Version
/** 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;

DLRLayoutConstraint Examples

/** 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];

UINavigationController+DLR Category Examples

/** 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;

UIViewController+DLRNavigationController Category Examples

/** Returns a new navigation controller instance with this view controller as the
 root view controller. */
- (UINavigationController *)dlr_embedInsideNavigationController;

UIViewController+DLRPresentedViewController Category Examples

/** Returns the top most presented view controller, which could be this view controller. */
- (UIViewController *)dlr_topPresentedViewController;

Latest podspec

{
    "name": "DLRUIKit",
    "version": "1.4.0",
    "summary": "A collection of UIKit categories.",
    "homepage": "https://github.com/detroit-labs/dlr-uikit-ios",
    "license": "MIT",
    "authors": {
        "Nathan Walczak": "[email protected]"
    },
    "source": {
        "git": "https://github.com/detroit-labs/dlr-uikit-ios.git",
        "tag": "1.4.0"
    },
    "social_media_url": "https://twitter.com/detroitlabs",
    "platforms": {
        "ios": null
    },
    "requires_arc": true,
    "source_files": "DLRUIKit/source/**/*",
    "public_header_files": "DLRUIKit/source/**/*.h"
}

Pin It on Pinterest

Share This