有时候我们想做一个,类似于UIActionSheet的东西,而UIActionSheet又不能满足我们,那么我们就可以用JGActionSheet来实现。
JGActionSheetSection的下载URL:
http://code4app.com/ios/JGActionSheet/53f31014933bf02c718b550b
要使用JGActionSheet就要引用JGActionSheet.h文件
JGActionSheetSection的思路是:
sheet,是全部的框体,一个sheet里面,包含很多个section,每个section下呢,又包含很多button,所以当用sheet.sections取值的时候,实际上取出的是一个数组,section.buttons也是同理。
代码:
//初始化一个section
//初始化的section的title是section title,在标题底下的方位会显示message,内容是message under title,buttonTitles参数是一个数组参数,里面是这个section里面的button的名字,buttonStyle参数是button的样式,这个样式也可以自己定义
JGActionSheetSection *section = [JGActionSheetSection sectionWithTitle:@"section title" message:@"message under title" buttonTitles:@[@"button1",@"button2"] buttonStyle:JGActionSheetButtonStyleDefault];
//初始化sheet,需要传入一开始初始化的section,是一个数组参数
JGActionSheet *sheet = [JGActionSheetactionSheetWithSections:@[section]];
//设置dletegate
sheet.delegate = self;
//sheet悬停的设置
sheet.insets = UIEdgeInsetsMake(20.0f, 0.0f, 0.0f, 0.0f);
//显示这个sheet
[sheet showInView:self.XXXXXXX.viewanimated:YES];
//点击里面任意button的回调事件
[sheet setButtonPressedBlock:^(JGActionSheet *sheet, NSIndexPath *indexPath) {
//取得点击的button在哪个section(indexPath.section是section的下标)
JGActionSheetSection *JGS = (JGActionSheetSection *)sheet.sections[indexPath.section];
//取得点击的那个button(indexPath.row是section里面button的下标)
UIButton *btn = JGS.buttons[indexPath.row];
//关闭悬浮框
[sheet dismissAnimated:YES];
XXXXXXXXXXXXX;
}
相关推荐
IOS动感漂亮IOS7风格下拉提示框,内置三个效果 非常实用
仿苹果手机 悬浮球 ,可以在手机上随意拖动,修改css可改变起始位置和大小
iOS 自定义 提示框,不知道怎么写的可以下载参考,其中 用到第三方库 “Masonry”,可以 pod 安装。
Android 仿IOS提示框
ios上弹出提示框特效,可以很方便的使用
在从iOS8到iOS9的升级过程中,弹出提示框的方式有了很大的改变,在Xcode7 ,iOS9.0的SDK中,已经明确提示不再推荐使用UIAlertView,而只能使用UIAlertController,我们通过代码来演示一下。
仿ios弹出提示框
ios提示框的封装,实现方便快捷的操作,节省更多的时间
简洁的 iOS 悬浮消息栏.zip,Whisper is a component that will make the task of display messages and in-app notifications simple. It has three different views inside
第三方的提示框,仿ios,使用方法见博客.zip
iOS 引导页面,简单的小框架.zip,A simple and interactive framework for making iOS onboarding experience easy and fun!
ios hud 提示框
iOS Toast提示框 (Objective-C)
梦幻朦胧唯美背景,点、圈、线条元素创意封面,半透明图表、半透明图文排版,半透明风格设计,适合商务工作总结、工作汇报的iOS风格通用ppt模板。
iOS开发必备提示框,有多种提示框选项,样式可以自定义,耦合度低,操作性强
唯美蓝色星空背景,极简文字标题封面,细线框目录页,极简线条半透明风格图表,适合商务工作汇报、工作总结、个人总结等场景应用的唯美星空极简大气半透明iOS风格ppt模板。
MBProgressHUD和SVProgressHUD IOS提示框
自定义提示框
iOS进度悬浮窗.zip,一个进度窗口隐藏显示的背景视图控制器(如下载),点击返回视图控制器。
唯美朦胧光斑蓝色背景,大字标题极简封面设计,线条框、几何图形、细线、半透明元素设计,唯美朦胧蓝色光斑背景极简细线半透明iOS风格商务工作汇报ppt模板。