UICustomSheet 1.0.2

UICustomSheet 1.0.2

测试已测试
语言语言 Obj-CObjective C
许可协议 MIT
发布上次发布2015年5月

Paul Chernovolenko 维护。



  • 作者:
  • Paul Chernovolenko

UICustomActionSheet

完全可定制的 UIActionSheet 替代品。兼容 iOS 7 和 8。

此自定义 ActionSheet 还可以通过模糊展示视图的背景来强调与菜单相关的元素,同时元素本身保持清晰。

Screen1 Screen2

如何使用

简单地在同一方式中初始化 UICustomActionSheet 对象,就如同您做 UIActionSheet 一样

UICustomActionSheet *actionSheet = [[UICustomActionSheet alloc] initWithTitle:@"Hello World" delegate:self buttonTitles:@[@"Bottom button",@"Top button"]];

如果您不希望在 ActionSheet 中显示标题,请将 title 设置为 nil。要在视图中展示 UICustomActionSheet,您可以使用与 UIActionSheet 相同的方法

[actionSheet showInView:self.view];

要处理 UICustomActionSheet 的事件,展示控制器必须实现 UICustomActionSheetDelegate 的方法

-(void)customActionSheet:(UICustomActionSheet *)customActionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
    NSLog(@"%d",buttonIndex);
}

进行您需要的任何定制

使用方法进行定制

-(void)setButtonColors:(NSArray *)colors - 设置按钮颜色的数组。如果 colors 数组包含的元素少于 UICustomActionSheet 中的按钮数,则只有前 [colors count] 个按钮将用数组中指定的颜色着色,所有其他按钮将用 tintColor(默认为 grayColor)着色

-(void)setTitle:(NSString *)title andSubtitle:(NSString *)subtitle - 为 UICustomActionSheet 设置标题和副标题。默认情况下,这两个值都是 nil

使用属性进行定制

颜色

tintColor - UICustomActionSheet 按钮的标准颜色

backgroundColor - 面板背景的颜色。使用 [UIColor clearColor] 生成透明颜色

blurTintColor - 如果 blurredBackground = YES,则用此颜色对 UICustomActionSheet 的背景进行着色。默认值为 [UIColor colorWithWhite:0.1 alpha:0.4]

titleColor - UICustomActionSheet 的标题颜色。默认值为 whiteColor

subtitleColor - UICustomActionSheet 的副标题颜色。默认值为 lightGrayColor

buttonsTextColor - 按钮的正常状态文本颜色。默认值为 whiteColor

标题和副标题字体大小

subtitle - 副标题文本。如果它是 nil,则不会产生影响

subtitleFontSize - 副标题文本字体大小。默认值为 14.0

title - 主要标题文本。如果它是 nil,则不会产生影响

titleFontSize - 标题文本尺寸值。默认值为 22.0

背景自定义

blurredBackground - bool 类型的值。如果您不希望模糊 UICustomActionSheet 演示视图,请将其设置为 NO。默认值为 YES

clearArea - CGRect 类型的值。当 blurredBackground = YES 时,接收不会模糊的矩形区域

授权

MIT 许可协议(MIT)

软件按“原样”提供,不提供任何形式的保证,无论是明确的还是隐含的,包括但不限于适销性、针对特定目的的适用性和非侵权性。在任何情况下,作者或版权所有者不对任何索赔、损害或其他责任负责,无论该责任源于合同、侵权或其他原因,以及与软件或其使用或其他交易相关的任何软件。