MXKit 5.5.8

MXKit 5.5.8

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release May 2018

Maintained by Meniny.



MXKit 5.5.8

  • By
  • Elias Abel

MXKit-in-Objective-C

MXKit is a bundle of categories of CocoaTouch.

Installation with CocoaPods

pod 'MXKit'

You may need to clean the caches of MXKit first:

pod cache clean 'MXKit'

Usage

#import "MXKit.h"

Just see the demo project.

Samples

  • TODO & FIXME
$FIXME(This)
$TODO(works too)
  • Attributed String From HTML String
NSString *html = @"<center><p style=\"color: red;\">Welcome to:</p><a href=\"http://www.meniny.cn\">Meniny.cn</a><br>MXKit Demo</center>";
NSAttributedString *att = [html attributedStringFromHTML];
  • UIImage copy
UIImage *img = [UIImage imageNamed:@"icon"];
if (img != nil) {
  UIImage *new_img = [img copy];
}
  • VFL
UILabel *label = [UILabel new];
[label setTranslatesAutoresizingMaskIntoConstraints:NO];
[[self view] addSubview:label];
NSDictionary *views = @{@"l": label};
[[self view] addConstraintsWithVFL:@"H:|[l]|" views:views];
[[self view] addConstraintsWithVFL:@"V:|[l]|" views:views];
  • AutoLayout

See MXAutoLayout.

  • QRCode Image
UIImage *qrcodeImage = [UIImage QRImageFromString:@"www.meniny.cn" cache:YES];
UIImage *newImage = [qrcodeImage addCenterIcon:[UIImage imageNamed:@"icon"]];
if (newImage != nil) {
  NSArray <NSString *>* strings = [qrcodeImage QRCodeDetect];
}
  • ScreenShot
UIImage *screen = [UIImage screenShot];
  • Device Info
NSString *carrier = [UIDevice carrierName];
NSString *freeDiskSize = [UIDevice freeDiskSpace];
  • UITextView with Placeholder
UITextView *textView = [][UITextView alloc] initWithFrame:frame];
[textView setPlaceholder:@"MXKit"];
  • RegEx
NSString *string = @"MXKit by Meniny (www.meniny.cn)";
NSArray <NSString *>* matches = [string matchesWithPattern:@"[a-z]+"];
NSString *newString = [string stringByReplacingOccurrencesOfPattern:@"meniny" withString:@"MENINY"];
// etc ...
  • Encrpyt
NSString *md5 = [@"MXKit" md5String];
  • JSON
NSDictionary *dic = @{@"key1": @"value1", @"key2": @2};
NSString *json = [dic JSONString];
  • Date
NSDate *now = [NSDate date];
NSDate *nextYear = [now dateByAddingYears:1];
NSLog(@"%@", [nextYear prettyString]);
  • iOS Version Check
BOOL iOS9AndLater = SystemVersionGreaterThanOrEqualTo(@"9.0");
  • UIView Framing
UIView *view = [UIView new];
[view setWidth:100];

And more...