ios中LeveyPopListView 弹出view的用法
下载地址https://github.com/levey/LeveyPopListView 是arc, 如果是非arc项目要设置一下
方法
选中工程->TARGETS->相应的target然后选中右侧的“Build Phases”,向下就找到“Compile Sources”了。
如何在未使用arc的工程中引入一个使用了arc特性的文件:对相应的文件添加:-fobjc-arc参数
#import <UIKit/UIKit.h>
#import "LeveyPopListView.h" @interface MyViewController : UIViewController<LeveyPopListViewDelegate> @end
#import "MyViewController.h"
@interfaceMyViewController ()
{
UILabel *lb;
}
@property(nonatomic,retain)NSArray *options;
@end
@implementation MyViewController
- (void)viewDidLoad
{
[superviewDidLoad];
self.view.backgroundColor=[UIColorwhiteColor];
//数据源
self.options = [NSArrayarrayWithObjects:
[NSDictionarydictionaryWithObjectsAndKeys:[UIImageimageNamed:@"facebook.png"],@"img",@"Facebook",@"text", nil],
[NSDictionarydictionaryWithObjectsAndKeys:[UIImageimageNamed:@"twitter.png"],@"img",@"Twitter",@"text", nil],
[NSDictionarydictionaryWithObjectsAndKeys:[UIImageimageNamed:@"tumblr.png"],@"img",@"Tumblr",@"text", nil],
[NSDictionarydictionaryWithObjectsAndKeys:[UIImageimageNamed:@"google-plus.png"],@"img",@"Google+",@"text", nil],
[NSDictionarydictionaryWithObjectsAndKeys:[UIImageimageNamed:@"linkedin.png"],@"img",@"LinkedIn",@"text", nil],
[NSDictionarydictionaryWithObjectsAndKeys:[UIImageimageNamed:@"pinterest.png"],@"img",@"Pinterest",@"text", nil],
[NSDictionarydictionaryWithObjectsAndKeys:[UIImageimageNamed:@"dribbble.png"],@"img",@"Dribbble",@"text", nil],
[NSDictionarydictionaryWithObjectsAndKeys:[UIImageimageNamed:@"deviant-art.png"],@"img",@"deviantArt",@"text", nil],
nil];
UIButton *btn=[UIButtonbuttonWithType:UIButtonTypeRoundedRect];
btn.frame=CGRectMake(0, 0, 100, 100);
lb=[[UILabelalloc] initWithFrame:CGRectMake(100, 100, 200,50)];
lb.backgroundColor=[UIColorclearColor];
[lbsetTextColor:[UIColorredColor]];
[self.viewaddSubview:lb];
[lbrelease];
[btn setTitle:@"TEST"forState:UIControlStateNormal];
[btn addTarget:selfaction:@selector(click) forControlEvents:UIControlEventTouchUpInside];
[self.viewaddSubview:btn];
// Do any additional setup after loading the view.
}
-(void)click{
//创建 LeveyPopListView
LeveyPopListView *lv=[[LeveyPopListViewalloc] initWithTitle:@"展示"options:self.options];
lv.delegate=self;
[lv showInView:self.viewanimated:YES];
[lv release];
}
#pragma mark 代理方法
- (void)leveyPopListView:(LeveyPopListView *)popListView didSelectedIndex:(NSInteger)anIndex{
NSLog(@"%zi",anIndex);
NSString *key=[self.options[anIndex] allValues][1];
lb.text=[NSStringstringWithFormat:@"返回数据-->%@",key];
}
- (void)leveyPopListViewDidCancel{
NSLog(@"取消");
}
@end
ios中LeveyPopListView 弹出view的用法的更多相关文章
- H5页面IOS中键盘弹出导致点击错位的问题
IOS在点击输入框弹出键盘 键盘回缩 后 定位没有相应改变 还有 textarea 也会弹出键盘 $("input").blur(function() { console.l ...
- IOS项目之弹出动画终结篇
在之前写过IOS项目之弹出动画一.IOS项目之弹出动画二.IOS项目之弹出动画三,今天来一个终极封装已经上传到Github上弹出动画总结篇UIPopoverTableView. UIPopoverTa ...
- IOS项目之弹出动画二
在IOS项目之弹出动画一中只是实现也功能,并没有体现面向对象的思想 ,今天就试着把它封装了一下,弹出视图的内容可以根据自定义,此处只是用UIDatePicker来演示 我把它传到了GitHub上 ...
- 【JSP】三种弹出对话框的用法实例
对话框有三种 1:只是提醒,不能对脚本产生任何改变: 2:一般用于确认,返回 true 或者 false ,所以可以轻松用于 if...else...判断 3: 一个带输入的对话框,可以返回用户填入的 ...
- JSP中添加弹出框
JSP中添加弹出框 %> <script language="javascript" type="text/javascript"> aler ...
- OA项目之弹出层中再弹出层
弹出层中再弹出一层如图: <asp:TextBox runat="server" ID="txtUName" CssClass="span2&q ...
- 【转】javascript入门系列演示·三种弹出对话框的用法实例
对话框有三种 1:只是提醒,不能对脚本产生任何改变: 2:一般用于确认,返回 true 或者 false ,所以可以轻松用于 if...else...判断 3: 一个带输入的对话框,可以返回用户填入的 ...
- ckfinder在IE10,IE9中的弹出框不能选择,或者不能上传解决方法
在IE9,或IE10中ckfinder在IE10,IE9中的弹出框不能选择,或者不能上传解决方法 把弹出框嵌入到jquery dialog中.可以解决 I did: // javascript f ...
- javascript入门系列演示·三种弹出对话框的用法实例
对话框有三种 1:只是提醒,不能对脚本产生任何改变: 2:一般用于确认,返回 true 或者 false ,所以可以轻松用于 if...else...判断 3: 一个带输入的对话框,可以返回用户填入的 ...
随机推荐
- iOS蓝牙空中升级(固件升级)
空中升级又叫固件升级,指你手机从服务器下载下来的包或者数据,通过蓝牙传输给你的外设升级固件.如果你能把蓝牙的基础搞懂,其实也并不是很难,我在这里只不过提供一下思路. 空中升级略难的地方在于数据处理和交 ...
- asp.net mvc源码分析-ModelValidatorProviders 客户端的验证
几年写过asp.net mvc源码分析-ModelValidatorProviders 当时主要是考虑mvc的流程对,客户端的验证也只是简单的提及了一下,现在我们来仔细看一下客户端的验证. 如图所示, ...
- [leetcode]N-Queens II @ Python
原题地址:https://oj.leetcode.com/problems/n-queens-ii/ 题意:和N-Queens这道题其实是一样的,只不过这次要求返回的时N皇后的解的个数的问题. 解题思 ...
- Java语言:JAVA8 十大新特性详解(zz)
关键词: Lambda表达式.函数式接口.方法与构造函数引用.接口的默认方法 原文地址: http://www.jb51.net/article/48304.htm 本教程将Java8的新特新逐一列出 ...
- JavaScript Math和Number对象研究
1. Math 对象 1.1 介绍 Math 对象,是数学对象,提供对数据的数学计算,如:获取绝对值.向上取整等.无构造函数,无法被初始化,只提供静态属性和方法. 1.2 构造函数 无 : ...
- C# 网络编程之webBrowser获取网页url和下载网页中图片
该文章主要是通过C#网络编程的webBrowser获取网页中的url并简单的尝试瞎子啊网页中的图片,主要是为以后网络开发的基础学习.其中主要的通过应用程序结合网页知识.正则表达式实现浏览.获取url. ...
- 利用vue-cropper做的关于图片裁剪、压缩、上传、预览等做的一个公共组件
公共组件: <template> <div> <div class="upload-box"> <div class="imag ...
- (转)C#中的委托(Delegate)和事件(Event)
转自:http://blog.chinaunix.net/uid-576762-id-2733751.html 把C#中的委托(Delegate)和事件(Event)放到现在讲是有目的的:给下次写 ...
- android中实现本地广播
上一篇文章实现了自定义广播: android中实现自定义广播 自定义广播允许被其他应用使用,有些情况下只允许广播在本应用范围内使用,可以用本地广播的方式实现 下面是实现的代码部分,MainActivi ...
- jQuery 用each后添加click
mydd = $('.plist'); mydd.each(function(i){ $(this).click(function(){ mydl.eq(i).hide("slow" ...