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

  • 相关阅读:
    老鼠走迷宫
    堆栈的应用 问题还未解决
    计数排序与基数排序
    C++类的描述
    选择排序 冒泡排序 插入排序
    计算名次
    多项式求值 n维多项式 Horner解法
    003_sublime如何实时预览markdown
    002_git下载的源码怎么打成jar包呢?
    001_idea常用插件
  • 原文地址:https://www.cnblogs.com/YouXianMing/p/3870584.html
Copyright © 2011-2022 走看看