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.10 更新日志 #22

Open
xaoxuu opened this issue Jun 2, 2017 · 0 comments
Open

0.0.10 更新日志 #22

xaoxuu opened this issue Jun 2, 2017 · 0 comments

Comments

@xaoxuu
Copy link
Owner

xaoxuu commented Jun 2, 2017

更改了一些layer相关设置的接口

想要实现圆角阴影效果可以这样:

UIView *view = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
view.backgroundColor = [UIColor yellowColor];
// 圆角半径30,阴影为向下投射的浮起样式
[view.layer ax_cornerRadius:30 shadow:LayerShadowDownFloat];
[self.view addSubview:view];

想自定义阴影效果可以这样:

[view.layer ax_customShadowWithOpacity:0.2 radius:5 offset:CGSizeMake(0, 4)];
// 或者
CGMutablePathRef squarePath = CGPathCreateMutable();
CGPathAddRect(squarePath, NULL, view.bounds);
[view.layer ax_customShadowWithOpacity:0.2 radius:5 offset:CGSizeMake(0, 4) color:[UIColor blueColor] path:squarePath];
CGPathRelease(squarePath);

将视图转换成图片

UIImage *img = UIImageFromView(self.view);

优化了Error的日志输出版式

使用示例:

NSError *error = [NSError ax_errorWithMaker:^(NSErrorMaker * _Nonnull error) {
    error.domain = @"my domain";
    error.code = 123;
    error.localizedDescription = @"desc123123";
    error.localizedFailureReason = @"reason123123";
    error.localizedRecoverySuggestion = @"suggestion123123";
    [error.localizedRecoveryOptions addObject:@"1. xxx"];
    [error.localizedRecoveryOptions addObject:@"2. xxx"];
}];

AXLogError(error);

qq20170603-001302 2x

当然,只写一个错误描述或者别的什么信息都是可以的:

NSError *error = [NSError ax_errorWithMaker:^(NSErrorMaker * _Nonnull error) {
    error.localizedDescription = @"发生了未知错误";
}];

AXLogError(error);

qq20170603-001404 2x

更方便的布局view

为view增加了快速获取bounds center的方法:

#pragma mark bounds center
@property (nonatomic, readonly, assign) CGPoint boundsCenter;
@property (nonatomic, readonly, assign) CGFloat boundsCenterX;
@property (nonatomic, readonly, assign) CGFloat boundsCenterY;

更容易将某个控件放置到父视图中间

比较两个版本新旧

对比服务器端的版本(remoteVersion)和当前app版本([NSBundle ax_appVersion])

VersionLaterThanVersion(remoteVersion, [NSBundle ax_appVersion], ^(BOOL later) {
    if (later) {
        // @xaoxuu: 有新版本
    } else {
        // @xaoxuu: 有新版本
    }
}, ^(NSError * _Nonnull error) {
    AXLogError(error);
});

版本必须都以"."分隔,并且两个版本的"."的个数相同

@xaoxuu xaoxuu changed the title 0.0.10 更新日志 0.1.0 更新日志 Jun 2, 2017
@xaoxuu xaoxuu changed the title 0.1.0 更新日志 0.0.10 更新日志 Jun 2, 2017
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