Latest 5.5.8
Homepage https://github.com/Meniny/MXKit-in-Objective-C
License MIT
Platforms ios 8.0, requires ARC
Frameworks Foundation, UIKit, CoreLocation, CoreTelephony, CoreGraphics, MobileCoreServices


MXKit

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'

Trouble Shooting

MXLocation

MXLocation was removed since 5.5.7 because it confuses people. Use CLLocationCoordinate2D instead.

Usage

#import <MXKit/MXKit.h>
import MXKit

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 = ;
  • 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…

Latest podspec

{
    "name": "MXKit",
    "version": "5.5.8",
    "summary": "A bundle of categories of CocoaTouch.",
    "description": "A stable version of MXKit, a bundle of categories of CocoaTouch.",
    "homepage": "https://github.com/Meniny/MXKit-in-Objective-C",
    "license": "MIT",
    "authors": "Elias Abel",
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/Meniny/MXKit-in-Objective-C.git",
        "tag": "5.5.8"
    },
    "source_files": "MXKit/**/*.{h,m}",
    "resources": "MXKit/MXKit/MXFoundationPlus/NSDate/DateTools.bundle",
    "frameworks": [
        "Foundation",
        "UIKit",
        "CoreLocation",
        "CoreTelephony",
        "CoreGraphics",
        "MobileCoreServices"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This