YCHActionSheet 1.0.2

YCHActionSheet 1.0.2

测试已测试
语言语言 Obj-CObjective C
许可 MIT
发布上次发布2014 年 12 月

Yaman JAIOUCH 维护。



  • Yaman JAIOUCH

功能

YCHActionSheet 是一个可视上分为几个部分的 UIActionSheet。

安装

Podfile

pod 'YCHActionSheet'

或者简单地将 YCHActionSheet.hYCHActionSheet.m 拖入您的项目中,即可开始使用。

要求

仅在 iPhone 设备上运行 (iOS > 7.0)。iPad 的更新应该很快就会可用。

如何使用

第一步是准备您的部分,通过使用以下方法创建 YCHActionSheetSection 对象

- (instancetype)initWithTitle:(NSString *)title otherButtonTitles:(NSString *)otherButtonTitles, ...;

或者

+ (instancetype)sectionWithTitle:(NSString *)title otherButtonTitles:(NSString *)otherButtonTitles, ...;

您也可以通过使用来创建一个破坏性部分(唯一的按钮)

+ (instancetype)destructiveSectionWithTitle:(NSString *)title;

部分准备好后,使用以下方法初始化一个 YCHActionSheet 对象

- (instancetype)initWithSections:(NSArray *)sections cancelButtonTitle:(NSString *)cancelButtonTitle delegate:(id<YCHActionSheetDelegate>)delegate;

然后使用以下方法显示它

- (void)showInView:(UIView *)view;

代理

YCHActionSheetDelegate 提供可以用来拦截事件的方*

// called when a button was clicked at section index and button index
- (void)actionSheet:(YCHActionSheet *)actionSheet clickedButtonAtIndex:(NSUInteger)buttonIndex sectionIndex:(NSUInteger)sectionIndex;

// called when a user clicked on the Cancel button
- (void)actionSheetDidCancel:(YCHActionSheet *)actionSheet;

// called before / after an action sheet is shown
- (void)willPresentActionSheet:(YCHActionSheet *)actionSheet;
- (void)didPresentActionSheet:(YCHActionSheet *)actionSheet;

// called before / after an action sheet is dismiss
- (void)willDismissActionSheet:(YCHActionSheet *)actionSheet;
- (void)didDismissActionSheet:(YCHActionSheet *)actionSheet;

// Called when a button is clicked. Returning NO will prevent the click from dismissing the action sheet.
// The default is YES.
- (BOOL)actionSheet:(YCHActionSheet *)actionSheet shouldDismissForButtonAtIndex:(NSUInteger)buttonIndex sectionIndex:(NSUInteger)sectionIndex;

改进

UILabel在使用 Autolayout 的时候似乎有一个奇怪的效果:它在旋转动画非常开始的时候取最后的frame,导致动画很难看。如果有人已经找到了这个问题的解决方法,我会很欣赏。

MIT 许可

版权所有 (c) 2014 Yaman JAIOUCH

本协议向任何取得本软件及其相关文档副本("软件")的个人免费授予在此软件上无限制处理的权限,包括但不限于使用、复制、修改、合并、出版、分发、再许可及/或出售软件的副本,并且允许获得本软件的个人将本软件提供给别人使用,前提是满足以下条件

上述版权声明和本许可声明应包含于本软件的所有副本或主要部分中。

本软件按“原样”提供,不提供任何形式的保证,无论是明示还是暗示,包括但不限于商品的适销性、适用于特定目的以及非侵权的保证。在任何情况下,作者或版权所有者不应对任何索赔、损害或其他责任承担责任,不论是由于合同行为、侵权或其他原因,由此产生的、因使用该软件或其他方式与之相关联的行为导致的责任。

版本发布说明

版本 1.0.2

  • YCHActionSheet 现在完全使用 AutoLayout

版本 1.0.1

  • 添加 -[actionSheet:shouldDismissForButtonAtIndex:sectionIndex:] 委托方法(感谢 @jacksonh)

版本 1.0

  • 首次发布