TZShortKit 0.1.0

TZShortKit 0.1.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Unclaimed.



  • By
  • Tadeu Zagallo

Small library with a few helpers that I use daily to save up some code.

example:

instead of:

CGRect frame = view.frame;
frame.size.width -= 20;
view.frame = frame;

you can write:

view.frame.width -= 20;

Categories provided

  • UIImage.width and UIImage.height
  • UIView:
    • CGFloat x
    • CGFloat y
    • CGFloat width
    • CGFloat height
    • CGFloat boundsX
    • CGFloat boundsY
    • CGFloat boundsWidth
    • CGFloat boundsHeight
    • CGPoint origin
    • CGPoint boundsOrigin
    • CGSize size
    • CGSize boundsSize
  • UIButton
    • UIImage *image
    • UIImage *backgroundImage
    • UIImage *selectedImage
    • UIImage *selectedBackgroundImage
    • NSString *title
    • NSString *selectedTitle

Other helpers:

  • Device helpers
BOOL IsRetinaScreen();
BOOL IsRetina4Screen();
CGFloat iOSVersion();
BOOL iOSVersionIsAtLeast(CGFloat version);
BOOL iOSVersionIsAtMost(CGFloat version);
BOOL iOSVersionIsGreatherThan(CGFloat version);
BOOL iOSVersionIsLessThan(CGFloat version);
  • Notification helpers (I tried to make notifications as easy and flexible as possible, so there are a lot of optional parameters)

    On(NSString *event[, id object], NotificationBlock block);
    On(NSString *event[, id object], id target, NSString *selectorName);
    Off(NSString *event[, NotificationBlock block]);
    Off(NSString *event[, id target, NSString *selectorName]);
    Trigger([id sender,] NSString *event [, NSDictionary *userInfo]);
    • Clarifying notification parameters: The second On method could be originally written as:
    [[NSNotificationCenter defaultCenter] addObserver:target
                                          selector:NSSelectorFromString(selectorName)
                                          name:event
                                          object:object];

    Alternatively you may substitute the target and selector for a block...