CustomActionsheet 0.1.1

CustomActionsheet 0.1.1

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

kamarshad维护。



这是一个自定义的actionsheet,显示在UIWindow顶部。无需担心显示/关闭动画的详细部分,它会在内部处理所有这一切。

使用方法

要运行示例项目,请克隆仓库,然后首先从Examples目录运行pod install

如何调用

要在您的应用程序中使用显示actionsheet,请按照以下步骤操作。

`#import "MKSActionSheetController.h"`

如果您想显示有一个标题两个按钮以及取消按钮的actionsheet,则您的代码应该如下所示。

`MKSActionSheetController* actionsheetController = [[MKSActionSheetController alloc] init];

 [actionsheetController showActionsheetInController:self
                        title:@"Actionsheet title" //Actionsheet header title text
                        backgroundColor:[UIColor lightGrayColor] //Actionsheet background color
                        cancelButtonTitle:@"CancelButton title" //Cancel button title text 
                        button1Title:@"Button1 title"  //Button1 title text 
                        button2Title:@"Button1 title"  //Button2 title text 
                        cancelButtonColor:[UIColor lightGrayColor]//Cancel button title text color
                        button1Color:[UIColor darkGrayColor] //Button1 title text color
                        button2Color:[UIColor darkGrayColor] //Button2 button title text color
                        completionBlock:^(kActionsheetTappedButtonIndex index) {
                        //Dissmiss Actionsheet controller
                            [actionsheetController dismissActionsheet];
                        //Do appropriate action
}];`

如果您想显示只有一个包含取消按钮单个按钮的actionsheet,且没有标题背景颜色

    `MKSActionSheetController* actionsheetController = [[MKSActionSheetController alloc] init];

    [actionsheetController showActionsheetInController:self
                            title:nil //Actionsheet header title text
                            backgroundColor:nil //Actionsheet background color
                            cancelButtonTitle:@"CancelButton title" //Cancel button title text 
                            button1Title:@"Button1 title"  //Button1 title text 
                            button2Title:nil   //Button2 title text 
                            cancelButtonColor:[UIColor lightGrayColor]//Cancel button title text color
                            button1Color:[UIColor darkGrayColor] //Button1 title text color
                            button2Color:nil //Button2 title text color
                            completionBlock:^(kActionsheetTappedButtonIndex index) {

                                //Dissmiss Actionsheet controller
                                   [actionsheetController dismissActionsheet];
                                //Do appropriate action
    }];`

要求

它运行在iOS 7及以上的操作系统版本。

安装

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

pod 'CustomActionsheet'

作者

Mohd Kamar Shad,[email protected]

许可

CustomActionsheet可在MIT许可下使用。有关更多信息,请参阅LICENSE文件。