Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lbrndnr/lbactionsheet
A very customizable drop-in replacement for UIActionSheet
https://github.com/lbrndnr/lbactionsheet
Last synced: about 2 months ago
JSON representation
A very customizable drop-in replacement for UIActionSheet
- Host: GitHub
- URL: https://github.com/lbrndnr/lbactionsheet
- Owner: lbrndnr
- Created: 2013-02-17T20:24:08.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-04-05T16:45:29.000Z (over 11 years ago)
- Last Synced: 2024-10-31T15:44:14.396Z (2 months ago)
- Language: Objective-C
- Homepage: http://laurinbrandner.ch
- Size: 253 KB
- Stars: 47
- Watchers: 6
- Forks: 10
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LBActionSheet
## About
LBActionSheet is a drop-in replacement for UIActionSheet. However, its API makes it very easy to customize it. It's designed for this sole purpose only which makes it redundant when you don't need to implement a custom theme.## Usage
LBActionSheet's API is almost the same as UIActionSheet's. It might change in the future though. You should hit it off with it anyway.## Installation
1. Drag the `LBActionsSheet` folder into your project.
2. Import the `CoreImage.framework`.### Example
```objc
LBActionSheet* sheet = [[LBActionSheet alloc] initWithTitle:@"Discard?" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Discard" otherButtonTitles:@"Save as draft", nil]; [sheet setDefaultButtonBackgroundImage:[[UIImage imageNamed:@"actionsheet-button"] stretchableImageWithLeftCapWidth:7 topCapHeight:0] forState:UIControlStateNormal];
[sheet setDefaultButtonBackgroundImage:[[UIImage imageNamed:@"actionsheet-button-pressed"] stretchableImageWithLeftCapWidth:7 topCapHeight:0] forState:UIControlStateHighlighted];
sheet.backgroundImage = [UIImage imageNamed:@"actionsheet-background"];
NSMutableDictionary* titleAttributes = [NSMutableDictionary new];
[titleAttributes setObject:[UIFont fontWithName:@"HelveticaNeue-Bold" size:24.0f] forKey:UITextAttributeFont];
[titleAttributes setObject:[UIColor whiteColor] forKey:UITextAttributeTextColor];
[titleAttributes setObject:[UIColor colorWithWhite:0.0f alpha:0.5f] forKey:UITextAttributeTextShadowColor];
[titleAttributes setObject:[NSValue valueWithCGSize:CGSizeMake(0.0f, 1.0f)] forKey:UITextAttributeTextShadowOffset];
[sheet setButtonTitleAttributes:titleAttributes forState:UIControlStateNormal];
[sheet setButtonTitleAttributes:titleAttributes forState:UIControlStateHighlighted];
UIImageView* separator = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, CGRectGetWidth([UIScreen mainScreen].applicationFrame), 3.0f)];
separator.image = [UIImage imageNamed:@"actionsheet-separator"];
[sheet insertControl:separator atIndex:self.cancelButtonIndex];
[sheet showInView:self.view];
```## Requirements
ARC.## License
LBActionSheet is licensed under the [MIT License](http://opensource.org/licenses/mit-license.php).