DYNCore
Version
0.0.4
Description
A iOS development basics tools. An easy way to develop your app.
Some category like: UIColor+DYN, UIImage+DYN, UIScreen+DYN, UIView+DYN ...
Some helper like: DYNURLSession, DYNUtils, DYNDeviceInfo ...
Some macro like: DYNWeakSelf, DYNStrongSelf, DYNColorHex, DYNHintShow, DYNLog ...
Some widget like: DYNAlertView, DYNCheckBox, DYNHint, DYNLoadingView, DYNSingleLabel, DYNMultiLabel ...
How to use
Installation with CocoaPods:pod 'DYNCore'
Introduce
If you want to use something about category:
#import "DYNCategory.h"
DYNCategory include:
NSData+DYNCommonCrypto
NSData+DYNBase64
NSString+DYN
NSString+DYNBase64
UIColor+DYN
UIImage+DYN
UIScreen+DYN
UIView+DYN
UIViewController+DYN
UIWebView+DYN
If you want to use something about helper(tools):
#import "DYNHelper.h"
FYCHelper include:
DYNAESUtil
DYNDBHelper
DYNDeviceInfo
DYNRSAUtil
DYNStorage
DYNTimer
DYNURLSession
DYNUtils
If you want to use something about macro:
#import "DYNMacro.h"
DYNMacro include:
DYNWeakSelf(weakSelf)
DYNStrongSelf(strongSelf)
DYNStatusBarHeight
DYNIsPad
DYNIsPhone
DYNIsIPhoneX
DYNColorHex(hex)
DYNIsLandscape
DYNIsPortrait
DYNRulerScreenShortSide(scale)
DYNRulerScreenLongSide(scale)
DYNRulerScreenWidth(scale)
DYNRulerScreenHeight(scale)
DYNRulerViewWidth(view, scale)
DYNRulerViewHeight(view, scale)
DYNHintShow(title)
DYNLog(format, ...)
If you want to use something about widget:
#import "DYNWidget.h"
DYNWidget inculde:
DYNAlertView
DYNCheckBox
DYNHint
DYNImageButton
DYNLableButton
DYNLine
DYNLoadingView
DYNMultiLabel
DYNSingleLabel
DYNTextField
Important And Frequently-used
- UIView+DYN
Easy way to get or set view frame.
self.view.frameWidth = 10;
self.view.frameOriginX = 10;
self.view.frameEndX = 10;
2.UIViewController+DYN
Easy way to get current controller view.
UIViewController *vc = [UIViewController currentViewController];
3.DYNURLSession
Easy way to reqeust http.
DYNURLSession *session = [[DYNURLSession alloc] initWithHTTPMethod:@"POST"];
NSString *url = @"http://www.xxx.com";
NSDictionary *params = @{
@"key0" : @"value0",
@"key1" : @"value1"
};
[session requestWithURL:url params:params response:^(BOOL connected, NSString *resp, NSDictionary *httpInfo) {
NSLog(@"#connected:%d", connected); // is connected success
NSLog(@"#resp:%@", resp); // response something, like JSON
NSLog(@"#httpInfo:%@", httpInfo); // request info and response info, like headers, status code and cookie
}];
4.DYNUtils Some common utils.
...
/// URL解码
+ (NSString*)urlDecode:(NSString*)string;
/// URL编码
+ (NSString*)urlEncode:(NSString*)string;
/// URL参数字符串解析成dictionary
+ (NSDictionary*)dictWithURLParams:(NSString*)string;
/// dictionary转成URL参数字符串
+ (NSString*)urlParamsWithDict:(NSDictionary*)dict;
/// JSON解析成NSDictionary
+ (NSDictionary*)dictWithJSON:(NSString*)jsonString;
/// Dictionary解析成JSON
+ (NSString*)JSONWithDict:(NSDictionary*)dict;
...
5.DYNAlertView
A simple custom alert view.
DYNAlertView *alert = [[DYNAlertView alloc] initWithTitle:@"title" content:@"some message xxxxx"];
alert.confirmBlock = ^{
NSLog(@"#click confirm");
};
alert.cancelBlock = ^{
NSLog(@"#click cancel");
};
[alert show];
6.DYNSingleLabel
A single-line label that self-adaption frame with text.
DYNSingleLabel *lable = [[DYNSingleLabel alloc] initWithText:@"single label"];
[self.view addSubview:lable];
7.DYNMultiLabel
A multi-line label that self-adaption frame with text.
DYNMultiLabel *label = [[DYNMultiLabel alloc] initWithText:@"this is a multi label xxxxxx xxxxxx xxxxxxx" textWidth:50];
[self.view addSubview:label];
Summary
This is a very useful tools when you develop.
It has a lot of other features for you.
Thanks.