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.11 更新日志 #23

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

0.0.11 更新日志 #23

xaoxuu opened this issue Jun 30, 2017 · 0 comments

Comments

@xaoxuu
Copy link
Owner

xaoxuu commented Jun 30, 2017

移除所有偏好设置

移除standardUserDefaults所有偏好设置

[NSUserDefaults ax_removeDefaultPersistentDomain];

声明:

/**
 移除默认的[NSUserDefaults standardUserDefaults]的所有配置
 */
+ (void)ax_removeDefaultPersistentDomain;

获取启动图片

// 启动图片
UIImage *img = [NSBundle ax_appLaunchImage];

声明:

/**
 启动图片路径

 @return 启动图片路径
 */
+ (NSString *)ax_appLaunchImagePath;

/**
 启动图片

 @return 启动图片
 */
+ (UIImage *)ax_appLaunchImage;

UITextField placeholder颜色

使用示例:

// 将textField的placeholder颜色设为主题色
textField.placeholderColor = axColor.theme;

获取一个类的所有子类

声明:

FOUNDATION_EXTERN NSArray *NSClassGetAllSubclasses(Class cls);

示例:

NSArray *arr = NSClassGetAllSubclasses([UIColor class]);
AXLogOBJ(arr);

// LOG信息如下:
2017-06-30 10:42:42.380764+0800 AXKitDemo[5400:2416565] 
➤ func:-[DebugVC viewDidLoad] line:22
💬[
NSColor,
UICIColor,
UIDisplayP3Color,
UICGColor,
UICachedDevicePatternColor,
UIDeviceWhiteColor,
UICachedDeviceWhiteColor,
UIDeviceRGBColor,
UICachedDeviceRGBColor,
UIPlaceholderColor
]

NSUserDefaults保存图片

使用示例:

// 保存图片
[NSUserDefaults ax_setImage:newImage forKey:@"AVATAR"];

// 读取图片
[NSUserDefaults ax_readImageForKey:@"AVATAR" completion:^(UIImage * _Nonnull image) {
    // 读取成功
    self.avatar.image = image;
} failure:^(NSError * _Nonnull error) {
    // 读取失败
    AXLogOBJ(error);
}];

UIAlertController创建ActionSheet

使用方法和alertView相同:(详情请见 #21

[UIAlertController ax_showActionSheetWithTitle:@"操作表" message:@"操作表描述" action:^(UIAlertController * _Nonnull alert) {
    [alert ax_addCancelAction];
    [alert ax_addDefaultActionWithTitle:@"确定" handler:^(UIAlertAction * _Nonnull sender) {

    }];
    [alert ax_addDestructiveActionWithTitle:@"删除" handler:^(UIAlertAction * _Nonnull sender) {

    }];
}];

声明:

/**
 弹窗(标题+消息+自定义按钮)(如果action为nil,则只有一个确定按钮)
 
 @param title 标题
 @param message 消息
 @param action action
 */
+ (void)ax_showActionSheetWithTitle:(nullable NSString *)title message:(nullable NSString *)message action:(void (^ __nullable)(UIAlertController *alert))action;


/**
 弹出一个【取消+确定】两个按钮的弹窗(如果action为nil,则只有一个确定按钮)
 
 @param title 标题
 @param message 消息内容
 @param ok 确定按钮事件
 */
+ (void)ax_showActionSheetWithTitle:(nullable NSString *)title message:(nullable NSString *)message ok:(void (^ __nullable)(UIAlertAction *sender))ok;

更改了默认颜色配置方法

示例:(AppDelegate.m)

// @xaoxuu: 配置主题色
[[UIColorManager sharedInstance] configDefaultTheme:^(UIThemeColorModel * _Nonnull color) {
    color.theme = [UIColor md_amber];
    color.accent = [UIColor md_lime];
    color.background = [UIColor whiteColor];
}];
// 更改axColor的颜色将不会自动缓存,需要调用[axColor saveCurrentTheme]进行缓存。
[axColor saveCurrentTheme];
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