• [翻译] 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 有标题,有描述按钮,以及取消按钮,展示用图片

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

    with map 支持地图

    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 的绝好素材 :)

  • 相关阅读:
    从helloworld回顾程序的编译过程之二
    笔试题知识点记录
    jQuery面试题与答案
    hdu2586(How far away ?)
    解析PHP跳出循环的方法以及continue、break、exit的区别介绍
    如何查看任何一下网站的全部二级域名?
    urlencode()与urldecode()
    基于 LaravelAdmin 在十分钟内搭建起功能齐全的后台模板
    第一种方式:cookie的优化与购物车实例
    右键菜单的响应问题
  • 原文地址:https://www.cnblogs.com/YouXianMing/p/3870584.html
Copyright © 2020-2023  润新知