[翻译] DoActionSheet

时间:2021-07-12 01:10:57

DoActionSheet

[翻译] DoActionSheet

https://github.com/donobono/DoActionSheet

An replacement for UIActionSheet : block-based, customizable theme, easy to use with image or map

用于替换UIActionSheet:基于block使用,自定义主题,方便展示图片或者地图

Preview

with title, with destructive button, with cancel button and with image 有标题,有描述按钮,以及取消按钮,展示用图片

[翻译] DoActionSheet

support scroll if there are many buttons but cancel button’s position is fixed 支持滚动,支持多按钮,只有取消按钮的位置是固定不动的

[翻译] DoActionSheet

with map 支持地图

[翻译] DoActionSheet

Requirements

  • iOS 7.0 and greater 支持iOS7及以上
  • ARC                       ARC

Examples

Code:

DoActionSheet *vActionSheet = [[DoActionSheet alloc] init];
// required
vActionSheet.nAnimationType = _sgType.selectedSegmentIndex; // there are 3 type of animation // optional
vActionSheet.dButtonRound = 2; // with image
vActionSheet.iImage = [UIImage imageNamed:@"pic1.jpg"];
vActionSheet.nContentMode = DoContentImage; // with map
vActionSheet.nContentMode = DoContentMap;
vActionSheet.dLocation = @{@"latitude" : @(37.78275123), @"longitude" : @(-122.40416442), @"altitude" : @200}; // launch DoActionSheet! - With destructive button, cancel button and title
vActionSheet.nDestructiveIndex = 2; [vActionSheet showC:@"What do you want for this photo?"
cancel:@"Cancel"
buttons:@[@"Post to facebook", @"Post to Instagram", @"Delete this photo"]
result:^(int nResult) { NSLog(@"---------------> result : %d", nResult); }]; // launch DoActionSheet! - With title and without cancel button
[vActionSheet show:@"What do you want?"
buttons:@[@"Open with Safari", @"Copy the link"]
result:^(int nResult) { NSLog(@"---------------> result : %d", nResult); }];
// customizable theme
#define DO_BACK_COLOR DO_RGB(232, 229, 222) // button background color
#define DO_BUTTON_COLOR DO_RGB(158, 132, 103)
#define DO_CANCEL_COLOR DO_RGB(240, 185, 103)
#define DO_DESTRUCTIVE_COLOR DO_RGB(124, 192, 134) // button text color
#define DO_TITLE_TEXT_COLOR DO_RGB(95, 74, 50)
#define DO_BUTTON_TEXT_COLOR DO_RGB(255, 255, 255)
#define DO_CANCEL_TEXT_COLOR DO_RGB(255, 255, 255)
#define DO_DESTRUCTIVE_TEXT_COLOR DO_RGB(255, 255, 255)

又一个学习 UIActionSheet 的绝好素材 :)