DYNCore 0.0.4

DYNCore 0.0.4

devyuan 维护。



DYNCore 0.0.4

  • DevYuan

DYNCore

版本

0.0.4

描述

iOS 开发基本工具。快速开发您的应用。

一些分类,如:UIColor+DYN, UIImage+DYN, UIScreen+DYN, UIView+DYN...

一些助手(工具),如:DYNURLSession, DYNUtils, DYNDeviceInfo...

一些宏,如:DYNWeakSelf, DYNStrongSelf, DYNColorHex, DYNHintShow, DYNLog...

一些部件,如:DYNAlertView, DYNCheckBox, DYNHint, DYNLoadingView, DYNSingleLabel, DYNMultiLabel...

如何使用

使用 CocoaPods 进行安装:pod 'DYNCore'

介绍

如果您想使用分类相关功能:

#import "DYNCategory.h"

DYNCategory 包含:

NSData+DYNCommonCrypto 

NSData+DYNBase64 

NSString+DYN 

NSString+DYNBase64 

UIColor+DYN 

UIImage+DYN 

UIScreen+DYN 

UIView+DYN

UIViewController+DYN

UIWebView+DYN

如果您想使用助手(工具):

#import "DYNHelper.h"

FYCHelper 包含:

DYNAESUtil

DYNDBHelper

DYNDeviceInfo

DYNRSAUtil

DYNStorage

DYNTimer

DYNURLSession

DYNUtils

如果您想使用关于宏的功能

#import "DYNMacro.h"

DYNMacro 包含

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

如果您想使用关于小部件的功能

#import "DYNWidget.h"

DYNWidget 包含

DYNAlertView

DYNCheckBox

DYNHint

DYNImageButton

DYNLableButton

DYNLine

DYNLoadingView

DYNMultiLabel

DYNSingleLabel

DYNTextField

重要且常用

  1. UIView+DYN

轻松获取或设置视图边框。

self.view.frameWidth = 10;
self.view.frameOriginX = 10;
self.view.frameEndX = 10;

2.UIViewController+DYN

轻松获取当前控制器视图。

UIViewController *vc = [UIViewController currentViewController];

3.DYNURLSession

轻松请求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 一些常用工具。

...

/// 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

一个简单的自定义警告视图。

DYNAlertView *alert = [[DYNAlertView alloc] initWithTitle:@"title" content:@"some message xxxxx"];
alert.confirmBlock = ^{
    NSLog(@"#click confirm");
};
alert.cancelBlock = ^{
    NSLog(@"#click cancel");
};
[alert show];

6.DYNSingleLabel

一行标签,自动适应文本框。

DYNSingleLabel *lable = [[DYNSingleLabel alloc] initWithText:@"single label"];
[self.view addSubview:lable];

7.DYNMultiLabel

多行标签,自动适应文本框。

DYNMultiLabel *label = [[DYNMultiLabel alloc] initWithText:@"this is a multi label xxxxxx xxxxxx xxxxxxx" textWidth:50];
[self.view addSubview:label];

总结

这是一个在您开发时非常有用的工具。

它为您提供了许多其他功能。

感谢。