XLBlockAlertView:UIAlertView使用Block着陆
XLBlockActionSheet:UIActionSheet使用Block着陆
UIImage *resultImage = [XLColorTool imageWithColor:[UIColor redColor]];
XPYCategoryTitleView和XPYCategoryContentView:分页切换控件,实现tab切换页面
XPYCopyLabel *label = [[XPYCopyLabel alloc] initWithFrame:CGRectMake(200, 200, 100, 50)];
label.text = @"点我复制";
[label sizeToFit];
label.isCanCopy = YES;
label.selelctedBackgroundColor = [UIColor grayColor];
[self.view addSubview:label];
runtime相关功能 MethodSwizzling
UIViewController+XPYScrollViewInsets:全局实现UIScrollViewContentInsetAdjustmentNever
NSArray+XPYAvoidOutOfRange:防止数组越界Crash
//截屏并保存到沙盒
UIImage *snapshotImage = [self.view snapshotImage];
NSString *cachePath = [XPYFileManager cacheFilePathWithKey:@"SnapshotCache"];
if ([XPYFileManager createCacheDirectoryWithFilePath:cachePath]) {
NSData *imageData = UIImagePNGRepresentation(snapshotImage);
NSString *dataPath = [cachePath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@_snapshop_image.png", @(self.hash)]];
if ([XPYFileManager saveFile:ima geData toPath:dataPath]) {
//获得已经保存的图片
NSData *data = [XPYFileManager dataWithFilePath:dataPath];
UIImage *image = [UIImage imageWithData:data];
NSLog(@"success");
}
}
XPYAlertController(链式编程Alert)和XPYAlertManager(管理XPYAlertController)
XPYAlertModel *alertModel = [[XPYAlertModel alloc] initWithTitle:@"提示" message:@"请注意xxxxxxxxxx" style:UIAlertControllerStyleActionSheet];
[XPYAlertController makeAlert:^(XPYAlertController * _Nonnull controller) {
UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
NSLog(@"取消");
}];
UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
NSLog(@"确定");
[XPYAlertManager showAlertWithTitle:@"确定" message:@"点击了确定" cancel:@"取消" confirm:@"确定" inController:self confirmHandler:^{
NSLog(@"alert confirm");
} cancelHandler:^{
NSLog(@"alert cancel");
}];
}];
UIAlertAction *action3 = [UIAlertAction actionWithTitle:@"哈哈" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
NSLog(@"哈哈");
[XPYAlertManager showActionSheetWithTitle:@"哈哈" message:@"点击了哈哈" cancel:@"取消" inController:self actions:@[@"item0", @"item1", @"item2"] actionHandler:^(NSInteger index) {
NSLog(@"click item%@", @(index));
}];
}];
controller.actionItems(@[action1, action2, action3]).showAlert(self);
} alertModel:alertModel];