MXKit 5.5.8

MXKit 5.5.8

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最后发布2018年5月

Meniny维护。



MXKit 5.5.8

  • 作者
  • Elias Abel

MXKit-in-Objective-C

MXKit 是 CocoaTouch 类别的集合。

使用 CocoaPods 进行安装

pod 'MXKit'

您可能需要先清理 MXKit 的缓存。

pod cache clean 'MXKit'

使用方法

#import "MXKit.h"

只需查看演示项目。

示例

  • 待办事项 & 修复
$FIXME(This)
$TODO(works too)
  • 从 HTML 字符串创建属性字符串
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];
  • 自动布局

查看 MXAutoLayout.

  • 二维码图像
UIImage *qrcodeImage = [UIImage QRImageFromString:@"www.meniny.cn" cache:YES];
UIImage *newImage = [qrcodeImage addCenterIcon:[UIImage imageNamed:@"icon"]];
if (newImage != nil) {
  NSArray <NSString *>* strings = [qrcodeImage QRCodeDetect];
}
  • 屏幕截图
UIImage *screen = [UIImage screenShot];
  • 设备信息
NSString *carrier = [UIDevice carrierName];
NSString *freeDiskSize = [UIDevice freeDiskSpace];
  • 具有占位符的 UITextView
UITextView *textView = [][UITextView alloc] initWithFrame:frame];
[textView setPlaceholder:@"MXKit"];
  • 正则表达式
NSString *string = @"MXKit by Meniny (www.meniny.cn)";
NSArray <NSString *>* matches = [string matchesWithPattern:@"[a-z]+"];
NSString *newString = [string stringByReplacingOccurrencesOfPattern:@"meniny" withString:@"MENINY"];
// etc ...
  • 加密
NSString *md5 = [@"MXKit" md5String];
  • JSON
NSDictionary *dic = @{@"key1": @"value1", @"key2": @2};
NSString *json = [dic JSONString];
  • 日期
NSDate *now = [NSDate date];
NSDate *nextYear = [now dateByAddingYears:1];
NSLog(@"%@", [nextYear prettyString]);
  • 检查 iOS 版本
BOOL iOS9AndLater = SystemVersionGreaterThanOrEqualTo(@"9.0");
  • UIView 框架
UIView *view = [UIView new];
[view setWidth:100];

等等...