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 ... )

Source: Internet
Author: User

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 ... )

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.