GithubHelp home page GithubHelp logo

ggalertaction's Introduction

GGAlertAction

cell实现Alert效果,可随意自定义选择视图

image 导入头文件 #import "AlertAction.h" #import "AlertView.h"

  • (void)viewDidLoad { [super viewDidLoad]; _actionImgShowRow = 0; } //图片固定不变
  • (IBAction)AlertClick:(id)sender { AlertView *alertView = [AlertView popoverView]; alertView.backgroundColor=[UIColor clearColor]; alertView.showShade = YES; // 显示阴影背景 [alertView showWithActions:[self QQActions]]; } //显示选择行数
  • (IBAction)selectAlertClick:(id)sender { AlertView *alertView = [AlertView popoverView]; alertView.backgroundColor=[UIColor clearColor]; alertView.showShade = YES; // 显示阴影背景 [alertView showWithActions:[self selectActions]];

}

//图片不会被隐藏

  • (NSMutableArray<AlertAction *> *)QQActions { // 发起多人聊天 action AlertAction *multichatAction = [AlertAction actionWithImage:[UIImage imageNamed:@"right_menu_multichat"] title:@"发起多人聊天" handler:^(AlertAction *action) { _textLabel.text = @"发起多人聊天"; }]; // 加好友 action AlertAction *addFriAction = [AlertAction actionWithImage:[UIImage imageNamed:@"right_menu_addFri"] title:@"加好友" handler:^(AlertAction *action) { _textLabel.text = @"加好友"; }]; // 扫一扫 action AlertAction *QRAction = [AlertAction actionWithImage:[UIImage imageNamed:@"right_menu_QR"] title:@"扫一扫" handler:^(AlertAction *action) { _textLabel.text = @"扫一扫"; }]; // 面对面快传 action AlertAction *facetofaceAction = [AlertAction actionWithImage:[UIImage imageNamed:@"right_menu_facetoface"] title:@"面对面快传" handler:^(AlertAction *action) { _textLabel.text = @"面对面快传"; }]; // 付款 action AlertAction *payMoneyAction = [AlertAction actionWithImage:[UIImage imageNamed:@"right_menu_payMoney"] title:@"付款" handler:^(AlertAction *action) { _textLabel.text = @"付款"; }]; // 取消 AlertAction *cancelAction = [AlertAction actionWithTitle:@"取消" handler:^(AlertAction *action) { _textLabel.text = @"取消"; }]; NSArray *section1 =@[multichatAction, addFriAction, QRAction, facetofaceAction, payMoneyAction]; NSArray *section2 =@[cancelAction]; NSMutableArray *actionArr=[NSMutableArray arrayWithObjects:section1, section2, nil]; return actionArr; }

//图片默认隐藏,选择后对应行数图片显示

  • (NSMutableArray<AlertAction *> *)selectActions { // 全部支付 action AlertAction *allPayAction = [AlertAction actionWithImage:[UIImage imageNamed:@"selcetShape"] title:@"全部支付" handler:^(AlertAction *action) { _textLabel.text = @"全部支付"; _actionImgShowRow = 0; }]; // 快捷支付 action AlertAction *fastAction = [AlertAction actionWithImage:[UIImage imageNamed:@"selcetShape"] title:@"快捷支付" handler:^(AlertAction *action) { _textLabel.text = @"快捷支付"; _actionImgShowRow = 1; }]; // 银行划账 action AlertAction *bankAction = [AlertAction actionWithImage:[UIImage imageNamed:@"selcetShape"] title:@"银行划账" handler:^(AlertAction *action) { _textLabel.text = @"银行划账"; _actionImgShowRow = 2; }]; // 微信支付 action AlertAction *weixinAction = [AlertAction actionWithImage:[UIImage imageNamed:@"selcetShape"] title:@"微信支付" handler:^(AlertAction *action) { _textLabel.text = @"微信支付"; _actionImgShowRow = 3; }]; // 支付宝支付 action AlertAction *zhifubaoAction = [AlertAction actionWithImage:[UIImage imageNamed:@"selcetShape"] title:@"支付宝支付" handler:^(AlertAction *action) { _textLabel.text = @"支付宝支付"; _actionImgShowRow = 4; }]; // 取消 AlertAction *cancelAction = [AlertAction actionWithTitle:@"取消" handler:^(AlertAction *action) { _textLabel.text = @"取消"; }];

    NSArray *section1 =@[allPayAction, fastAction, bankAction, weixinAction, zhifubaoAction]; NSArray *section2 =@[cancelAction]; AlertAction *alert=[[AlertAction alloc]init]; alert.selectRow = _actionImgShowRow; NSMutableArray *actionArr=[NSMutableArray arrayWithObjects:section1, section2, alert, nil]; return actionArr; }

ggalertaction's People

Contributors

jixiang0903 avatar

Stargazers

JuiceLv avatar depthlove avatar kims avatar  avatar lingo Lee avatar  avatar  avatar  avatar 石玉龙 avatar  avatar

Watchers

James Cloos avatar  avatar

Forkers

zhangziyao

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.