zoukankan      html  css  js  c++  java
  • [翻译] 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 的绝好素材 :)

  • 相关阅读:
    向存储过程中传入列表参数
    TRUNCATE TABLE (Transact-SQL)
    Program.cs
    联想G40-30 安装win10系统
    完美解决github访问速度慢[转]
    关于Visual studio 2017安装方法的若干问题
    [转载] 中国象棋软件-引擎实现(七)测试程序
    [转载] 中国象棋软件-引擎实现(六)局面评估
    [转载] 中国象棋软件-引擎实现(五)历史启发及着法排序
    [转载] 中国象棋软件-引擎实现(四)搜索算法
  • 原文地址:https://www.cnblogs.com/YouXianMing/p/3870584.html
Copyright © 2011-2022 走看看