Bobutils Tools Daquan
I github open source and collection features address: Https://github.com/niexiaobo
"Useful for developers who are new to iOS or within a year of working"
Common methods such as collection, add extension classes, Tool class methods, request method encapsulation (including image upload, etc.) have a lot of convenient and quick function ^_^
Usage:
只需要导入BOBsKit.h 头文件就行 // #import "BOBsKit.h"
Rely on a three-party library:
pod ‘SDWebImage‘, ‘~> 3.7.5‘ pod ‘MBProgressHUD‘, ‘~> 0.9.2‘ pod ‘AFNetworking‘, ‘~> 3.1.0‘
Simple example one or two description: 1, convenient and quick Set property value 1, add Title Property for button:
UIButton *testButton = [[UIButton alloc]init];testButton.title = @"按钮标题";
2, avoid crashes, greatly enhance the compatibility of the app:
//(运行时重写title点语法:Unbutton(添加),UIlabel,UItextfield,UItextView) UILabel等 赋值类型不匹配不会崩溃:从后台获取数据类型不匹配时正常运行。 //重写text属性 - (NSString *)text { return objc_getAssociatedObject(self, @selector(text)); } - (void)setText:(NSString *)text { NSString *tempText = (text==nil||[text isKindOfClass:[NSNull class]][email protected]"":text); if ([tempText isKindOfClass:[NSNumber class]]) { tempText = [NSString stringWithFormat:@"%@",tempText]; } else if (![tempText isKindOfClass:[NSString class]]) { tempText = @""; } objc_setAssociatedObject(self, @selector(text), tempText, OBJC_ASSOCIATION_RETAIN_NONATOMIC); }
3. Quickly set the UIView location Size property (so the UI control contains the frame property):
//快速设置宽度为50:testButton.width = 50;//系统方法:CGRect frame = self.frame;frame.width = 50;testButton.frame = frame;
iOS Development Summary: Utils common methods such as collection, add extension class, Tool class method, has a lot of convenient and fast function (constantly updated in ... )