基于 UIActionSheet 的一个基于块和可自定义的外观。
LSActionView.h
和 LSActionView.m
添加到您的项目中。#import "LSActionView.h"
。需要 iOS 4.3 及以上。
#import "LSActionView.h"
- (void)onShareTapped:(id)sender {
//show without button title
NSArray *images = @[@"icon_dropbox", @"icon_rss", @"icon_facebook", @"icon_twitter"];
[[LSActionView sharedActionView] showWithImages:images actionBlock:^(NSInteger index) {
NSLog(@"Action trigger at %ld:", (long)index);
}];
//show with button title
NSArray *titles = @[@"Dropbox", @"Rss", @"Facebook", @"Twitter"];
[[LSActionView sharedActionView] showWithImages:images titles:titles actionBlock:^(NSInteger index) {
NSLog(@"Action trigger at %ld:", (long)index);
}];
}
@property (strong, nonatomic) UIColor *blankAreaColor;
@property (strong, nonatomic) UIColor *containerColor;
@property (strong, nonatomic) UIColor *buttonTitleColor;
@property (assign, nonatomic) CGFloat buttonFontSize;
@property (assign, nonatomic) CGFloat containerMargin;
@property (assign, nonatomic) CGFloat buttonIconWidth;
@property (assign, nonatomic) CGFloat buttonTitleHeight;