JMActionSheetDescription 0.5.2

JMActionSheetDescription 0.5.2

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布上次发布2016 年 9 月

Jérôme Morissard 维护。




我的其他作品

http://leverdeterre.github.io

JMActionSheetDescription

使用描述组件替换 ActionSheet 和 UIActivityViewController。

功能

  • 显示标签
  • 显示操作 (UIButton)
  • 显示图片
  • 显示选择器
  • 显示日期选择器
  • 显示图标集合

变更日志

0.5.0 :

  • 改进 DatePicker (updateBlock, validateBlock)
  • 改进 Swift 兼容性

0.4.9 :

  • 添加 DatePicker 支持

0.4.7 / 0.4.8 :

  • 改进协议使用
  • 提高 Swift 兼容性
  • 修复自动布局(在演示中)

0.4.6 :

  • 修复自动旋转,
  • 修复 iOS7 崩溃,
  • 开始自动布局实现和旋转支持

0.4.5 :

  • 添加 iOS9 支持,
  • 添加 UITraitCollection 支持。
  • 添加 UIPopoverPresentationController 支持。

0.4.2 :

  • 添加多张图片选择支持。

0.4.0 :

  • 添加 UICollectionView 支持。

屏幕截图

Image Image Image Image Image Image Image Image

安装和用法

JMActionSheetDescription 通过 CocoaPods 提供。要安装它,只需将以下行添加到 Podfile 中

pod "JMActionSheetDescription"

手动创建

//init your description
JMActionSheetDescription *desc = [[JMActionSheetDescription alloc] init];

//Configure your colors
desc.actionSheetTintColor = [UIColor grayColor];
desc.actionSheetCancelButtonFont = [UIFont boldSystemFontOfSize:17.0f];
desc.actionSheetOtherButtonFont = [UIFont systemFontOfSize:16.0f];

//Cancel item
JMActionSheetItem *cancelItem = [[JMActionSheetItem alloc] init];
cancelItem.title = @"Cancel";
desc.cancelItem = cancelItem;

//Can configure a context for your action .. an url ? image ? (work in progress)
JMActionContextItem *contextItem = [[JMActionContextItem alloc] init];
contextItem.image = [UIImage imageNamed:@"gif_experiments"];
contextItem.imageHeight = 200.0f;
desc.contextItem = contextItem;
desc.title = @"Available actions for component";

//item + block
JMActionSheetItem *itemShare = [[JMActionSheetItem alloc] init];
itemShare.title = @"last action";
itemShare.action = ^(void){
    NSLog(@"last action pressed");
};

//Pickeritem + block
JMActionSheetPickerItem *pickerItem = [[JMActionSheetPickerItem alloc] init];
    pickerItem.elements = @[@"One", @"Two", @"three", @"Four"];
    pickerItem.pickerAction = ^(NSString *selectedValue){
        NSLog(@"selectedValue %@",selectedValue);
    };

desc.items = @[itemShare,pickerItem];
[JMActionSheet showActionSheetDescription:desc inViewController:self];

创建快捷方式

要显示选择器(JMDatePickerActionSheet)

NSDate *minDate = [NSDate date];
NSDate *minDate = [[NSDate date] dateByAddingTimeInterval:-60*60*24*1];
NSDate *maxDate = [[NSDate date] dateByAddingTimeInterval:60*60*24*60];

[JMDatePickerActionSheet showDatePickerActionSheetMinDate:minDate maxDate:maxDate selectedDate:selectedDate didSelectBlock:^(id selectedItem) {
      NSLog(@"Plop");
} 
title:@"MyTitle" 
inViewController:self];

要显示选择器(JMPickerActionSheet)

[JMPickerActionSheet showPickerActionSheetElements:@[@"One", @"Two", @"three", @"Four"]
                                    didSelectBlock:^(NSString *selectedValue){
                                                    NSLog(@"selectedValue %@",selectedValue);}
                                            title:@"JMPickerActionSheet methods"
                                inViewController:self];

显示多张图片选择(JMImagesActionSheet)

[JMImagesActionSheet showImagesActionSheetImages:@[
                        [UIImage imageNamed:@"gif_experiments"],
                        [UIImage imageNamed:@"gif_experiments"],
                        [UIImage imageNamed:@"gif_experiments"]],
                                updateBlock:^(id selectedValue) {
                                                NSLog(@"did updateBlock %@",selectedValue); }
                                validateBlock:^(id selectedValue) {
                                                NSLog(@"did validateBlock %@",selectedValue); }
                                        title:@"The title"
                            inViewController:self];

许可证

JMActionSheetDescription 在 MIT 许可证下提供。有关更多信息,请参阅 LICENSE 文件。