We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
字符串其实可以干更多事
- (nullable NSURL *)absoluteURL; - (BOOL)isURLString; - (nullable UIImage *)image;
例如我们获取到一个"URLString",用来显示用户头像
NSString *tmp = @"https://xaoxuu.com/images/avatar.png"; // 需要用到URL的话,就是tmp.absoluteURL // 需要判断它是不是合法的URL就 if (tmp.isURLString) { // 是URL } else { // 不是URL }
例如资源图片名为"test.png"
// 有一个ImageView名为imgv imgv.image = @"test".image;
做了一点简单的封装,让代码更简单
两个类都添加了一个移除分割线的方法:
/** 移除系统自带的分割线 */ - (void)ax_hideSeparator;
注意:分割线不是一开始就有的,因此建议都写在- viewDidLayoutSubviews中。
- viewDidLayoutSubviews
使用示例:
- (void)viewDidLayoutSubviews{ [super viewDidLayoutSubviews]; [self.tabBar ax_hideSeparator]; }
/** 粗略判断颜色是不是浅色调 @return 是不是浅色 */ - (BOOL)isLightColor;
例如判断背景颜色是浅色的话,文字颜色设为主题色,如果背景颜色是深色的话,文字颜色为白色:
// 假设view上面有一个label if (view.backgroundColor.isLightColor) { label.textColor = axColor.theme; } else { label.textColor = axColor.white; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
NSString+
字符串其实可以干更多事
例如我们获取到一个"URLString",用来显示用户头像
例如资源图片名为"test.png"
隐藏系统自带的NavigationBar/TabBar分割线?
两个类都添加了一个移除分割线的方法:
使用示例:
判断颜色是深色还是浅色?
例如判断背景颜色是浅色的话,文字颜色设为主题色,如果背景颜色是深色的话,文字颜色为白色:
The text was updated successfully, but these errors were encountered: