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

  • 相关阅读:
    微信小程序——引入WeUI组件库(二)
    微信小程序——引入WeUI组件库(一)
    Centos 安装Sentinel
    Nacos安装与启动教程
    vue 2.9.6升级到3X版本
    window consul安装和运行
    基于Vue、Springboot网站实现第三方登录之QQ登录,以及邮件发送
    Dockerfile创建镜像
    Docker端口映射和容器互联
    Docker数据管理
  • 原文地址:https://www.cnblogs.com/YouXianMing/p/3870584.html
Copyright © 2011-2022 走看看