GithubHelp home page GithubHelp logo

tiger8888 / ktcategories Goto Github PK

View Code? Open in Web Editor NEW

This project forked from keighl/ktcategories

0.0 1.0 0.0 249 KB

Some fun categories I use in a lot of my iOS projects!

License: MIT License

Ruby 2.41% Objective-C 97.59%

ktcategories's Introduction

KTCategories

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;

ktcategories's People

Contributors

keighl avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.