Latest 0.0.9
Homepage https://github.com/keighl/KTCategories
License MIT
Platforms ios 7.0, requires ARC
Frameworks UIKit
Authors

Some code I use in a lot of iOS projects!

pod 'KTCategories', git: 'https://github.com/keighl/KTCategories.git'

KTUtil.h

+ (NSArray *)visualConstraints:(NSString *)format views:(NSDictionary *)views;
+ (NSLayoutConstraint *)makeThis:(id)object equal:(NSLayoutAttribute *)attr toThat:(id)that;
+ (NSString *)intToString:(int)x;
+ (NSString *)floatToString:(float)x;
+ fallbackAnimateWithDuration:(float)duration
                        delay:(float)delay
       usingSpringWithDamping:(float)damping
        initialSpringVelocity:(float)velocity
                      options:(UIViewAnimationOptions)options
                   animations:(void (^)(void))animations
                   completion:(void (^)(BOOL finished))completion;

UIColor+KTExtras.h

+ (UIColor *)greyColorWithBrightness:(CGFloat)brightness;
+ (UIColor *)greyColorWithBrightness:(CGFloat)brightness alpha:(float)alpha;
+ (UIColor *)colorWithRGBHexString:(NSString *)rgbHexString;
+ (UIColor *)colorWithRGBHexString:(NSString *)rgbHexString alpha:(float)alpha;
- (UIColor *)colorWithAdjustedHue:(CGFloat)hue
                       saturation:(CGFloat)saturation
                       brightness:(CGFloat)brightness
                            alpha:(CGFloat)alpha;

KTEdgeLabel.h

  • Provides optional edgeInsets property for label ‘padding’

KTShapeView.h

  • Gives an autlayout-able view for a CAShapeLayer

    • (id)initWithShapeLayer:(CAShapeLayer *)shapeLayer

NSArray+KTExtras.h

- (NSArray *)removeDuplicatesUsingKey:(NSString *)key
                         withResolver:(KTDuplicateResolver)resolver;

UIView+KTExtras.h

For when you can’t use autolayout!

Anchor

(void)anchorToTop;
(void)anchorToTopWithMargin:(CGFloat)margin;
(void)anchorToTopInRect:(CGRect)rect withMargin:(CGFloat)margin;

(void)anchorToBottom;
(void)anchorToBottomWithMargin:(CGFloat)margin;
(void)anchorToBottomInRect:(CGRect)rect withMargin:(CGFloat)margin;

(void)anchorToLeft;
(void)anchorToLeftWithMargin:(CGFloat)margin;
(void)anchorToLeftInRect:(CGRect)rect withMargin:(CGFloat)margin;

(void)anchorToRight;
(void)anchorToRightInRect:(CGRect)rect withMargin:(CGFloat)margin;
(void)anchorToRightWithMargin:(CGFloat)margin;

(void)anchorToTopOnRect:(CGRect)rect withMargin:(CGFloat)margin;
(void)anchorToBottomOnRect:(CGRect)rect withMargin:(CGFloat)margin;
(void)anchorToLeftOnRect:(CGRect)rect withMargin:(CGFloat)margin;
(void)anchorToRightOnRect:(CGRect)rect withMargin:(CGFloat)margin;

Alignment

(void)centerX;
(void)centerXY;
(void)centerY;
(void)centerXYInRect:(CGRect)rect;
(void)centerXInRect:(CGRect)rect;
(void)centerYInRect:(CGRect)rect;
(void)centerXOnRect:(CGRect)rect;
(void)centerYOnRect:(CGRect)rect;

Relative Placement

(void)placeYAfterView:(UIView *)view withMargin:(CGFloat)margin;
(void)placeXAfterView:(UIView *)view withMargin:(CGFloat)margin;

(void)placeYBeforeView:(UIView *)view withMargin:(CGFloat)margin;
(void)placeXBeforeView:(UIView *)view withMargin:(CGFloat)margin;

Nudge

(void)padTopBy:(CGFloat)points;
(void)padBottomBy:(CGFloat)points;
(void)padLeftBy:(CGFloat)points;
(void)padRightBy:(CGFloat)points;

Corner Rounding

(void)roundByWidth;
(void)roundByHeight;
(void)roundBy:(CGFloat)radius;

Frame Adjustments

(void)setFrameOriginX:(CGFloat)x;
(void)setFrameOriginY:(CGFloat)y;
(void)setFrameSizeWidth:(CGFloat)width;
(void)setFrameSizeHeight:(CGFloat)height;

Latest podspec

{
    "name": "KTCategories",
    "version": "0.0.9",
    "summary": "A handful of semi-useful Categories and Classes",
    "homepage": "https://github.com/keighl/KTCategories",
    "license": "MIT",
    "authors": {
        "keighl": "[email protected]"
    },
    "source": {
        "git": "https://github.com/keighl/KTCategories.git",
        "tag": "0.0.9"
    },
    "social_media_url": "https://twitter.com/keighl",
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "KTCategories/*",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This