Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.0.5 更新日志 #2

Open
xaoxuu opened this issue Apr 19, 2017 · 0 comments
Open

0.0.5 更新日志 #2

xaoxuu opened this issue Apr 19, 2017 · 0 comments

Comments

@xaoxuu
Copy link
Owner

xaoxuu commented Apr 19, 2017

NSUserDefaults

增加了ax_cacheObject,与ax_cacheValue功能不同。区别参考系统的setObjectsetValue

增加了ax_removeObjectForKey方法。

NSString

增加了NSStringFromASCIIValue(unsigned char ASCIIValue)函数,快速将ASCII码值转换成OC字符串。

增加了一个快速输出百分比的函数,将浮点型CGFloat数据转换成0%~100%的格式化字符串

NSStringFromPercent(CGFloat x);
// 当传入x为小于或等于0的数时,NSStringFromPercent(x)为@"0%"。
// 当传入x为大于0并且小于1的数如0.3时,NSStringFromPercent(0.3)为@"30%"。
// 当传入x为大于或等于1的数时,NSStringFromPercent(x)为@"100%"。

取值

增加了NSInteger类型和CGFloat类型的取值范围

增加了确保值在某个范围的方法,示例:

// 希望value在0~1之间
CGFloat value = sender.text.floatValue;
CGFloat result = AXFloatInRange(value, AXFloatRangeMake(0, 1));
// 当value取值小于0时,result为0;
// 当value取值大于0小于1时,result为value;
// 当value取值大于1时,result为1;

支持的数据类型有:

  • CGFloat
  • NSInteger
  • NSUInteger

UIViewController

增加了万能控制器跳转方法,传入目标控制器名,跳转到目标控制器
此方法是安全的,会有失败回调

/**
 push view controller

 @param vcName view controller name
 @param animated animated
 */
- (void)ax_pushViewControllerNamed:(NSString *)vcName animated:(BOOL)animated;

/**
 push view controller
 
 @param vcName view controller name
 @param animated animated
 @param completion completion
 */
- (void)ax_pushViewControllerNamed:(NSString *)vcName animated:(BOOL)animated completion:(void (^)(UIViewController *targetVC))completion;

/**
 push view controller
 
 @param vcName view controller name
 @param animated animated
 @param completion completion
 @param fail error info
 */
- (void)ax_pushViewControllerNamed:(NSString *)vcName animated:(BOOL)animated completion:(void (^)(UIViewController *targetVC))completion fail:(void (^)(NSError *error))fail;

NSError

增加了方便的创建Error实例的构造方法

/**
 创建一个error实例

 @param domain 域
 @param code 错误码
 @param description 描述
 @param reason 原因
 @param suggestion 建议
 @return error实例
 */
+ (instancetype)ax_errorWithDomain:(NSErrorDomain)domain code:(NSInteger)code description:(nullable NSString *)description reason:(NSString *)reason suggestion:(nullable NSString *)suggestion;

AXLog

AXLogError(NSError)增加了一个输出内容,0.0.4版本及其之前只输出error.localizedDescription,0.0.5及之后版本现在还会增加一行信息error.localizedFailureReason

UIBarButtonItem

增加了快速创建自定义BarItem的构造方法

/**
 快速创建一个baritem
 
 @param view 自定义视图
 @param action 响应的事件
 @return baritem实例
 */
+ (instancetype)ax_itemWithCustomView:(UIView *)view action:(void (^)(id sender))action;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant