TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Jared Sinclair.
Replacement for UIActionSheet on iOS 7, with customizable fonts and colors, and block-based actions.
Both of these screenshots were made with JTSActionSheet. I've taken great pains to mimic the native look of UIActionSheet on iOS 7 where possible.
JTSActionSheet will help you if your project has any of these requirements:
Surprisingly, there aren't any other ready-made solutions available in the wild. So I made one.
Don't use this if you need:
It's pretty easy. The steps are:
JTSActionSheetTheme
, either from scratch or with defaultTheme
.JTSActionSheetItems
representing your buttons and cancel button.JTSActionSheet
.Here is some sample code showing it all together:
// Import this
#import "JTSActionSheet.h"
[...]
// Create a theme
JTSActionSheetTheme *theme = [JTSActionSheetTheme defaultTheme];
// Setup your buttons
JTSActionSheetItem *buyAll = [JTSActionSheetItem itemWithTitle:@"Buy All" action:^{
// do stuff
} isDestructive:NO];
JTSActionSheetItem *deleteAll = [JTSActionSheetItem itemWithTitle:@"Delete All" action:^{
// do stuff
} isDestructive:YES];
JTSActionSheetItem *cancel = [JTSActionSheetItem itemWithTitle:@"Cancel" action:^{
// respond to cancellation
// Action blocks can be nil if you want.
} isDestructive:NO];
// Create & Show an Action Sheet
JTSActionSheet *sheet = [[JTSActionSheet alloc] initWithTheme:theme
title:@"Your Options"
actionItems:@[buyAll, deleteAll]
cancelItem:cancel];
[sheet showInView:self.view];