下载地址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的用法的更多相关文章

  1. H5页面IOS中键盘弹出导致点击错位的问题

    IOS在点击输入框弹出键盘  键盘回缩 后 定位没有相应改变  还有  textarea 也会弹出键盘 $("input").blur(function() { console.l ...

  2. IOS项目之弹出动画终结篇

    在之前写过IOS项目之弹出动画一.IOS项目之弹出动画二.IOS项目之弹出动画三,今天来一个终极封装已经上传到Github上弹出动画总结篇UIPopoverTableView. UIPopoverTa ...

  3. IOS项目之弹出动画二

    在IOS项目之弹出动画一中只是实现也功能,并没有体现面向对象的思想 ,今天就试着把它封装了一下,弹出视图的内容可以根据自定义,此处只是用UIDatePicker来演示 我把它传到了GitHub上    ...

  4. 【JSP】三种弹出对话框的用法实例

    对话框有三种 1:只是提醒,不能对脚本产生任何改变: 2:一般用于确认,返回 true 或者 false ,所以可以轻松用于 if...else...判断 3: 一个带输入的对话框,可以返回用户填入的 ...

  5. JSP中添加弹出框

    JSP中添加弹出框 %> <script language="javascript" type="text/javascript"> aler ...

  6. OA项目之弹出层中再弹出层

    弹出层中再弹出一层如图: <asp:TextBox runat="server" ID="txtUName" CssClass="span2&q ...

  7. 【转】javascript入门系列演示·三种弹出对话框的用法实例

    对话框有三种 1:只是提醒,不能对脚本产生任何改变: 2:一般用于确认,返回 true 或者 false ,所以可以轻松用于 if...else...判断 3: 一个带输入的对话框,可以返回用户填入的 ...

  8. ckfinder在IE10,IE9中的弹出框不能选择,或者不能上传解决方法

    在IE9,或IE10中ckfinder在IE10,IE9中的弹出框不能选择,或者不能上传解决方法   把弹出框嵌入到jquery dialog中.可以解决 I did: // javascript f ...

  9. javascript入门系列演示·三种弹出对话框的用法实例

    对话框有三种 1:只是提醒,不能对脚本产生任何改变: 2:一般用于确认,返回 true 或者 false ,所以可以轻松用于 if...else...判断 3: 一个带输入的对话框,可以返回用户填入的 ...

随机推荐

  1. 重启Windows的PowerShell

    这么简单的一个命令都单独写一篇blog, 是不是太无耻了? 好吧, 谁让咱不会呢. 学会了就来一篇. 呵呵. Restart-Computer   来源 ================ http:/ ...

  2. Octave环境的安装

    Octave是一种解释类的编程语言,并且是GNU项目下的开源软件,与之相对是大家都非常熟悉的matlab,Octave和matlab语法基本上一致,都是用来快速做一些强大的矩阵运算来使用的,最大的不同 ...

  3. laravel 5.5 整合 jwt 报错Method Tymon\JWTAuth\Commands\JWTGenerateCommand::handle() does not exist解决

    今天介绍一个在laravel5.5新版本整合jwt  执行 php artisan jwt:generate 再生成密钥时报的一个错误 Method Tymon\JWTAuth\Commands\JW ...

  4. PHP使用DOM XML操作XML[总结]

    1.前言 XML树状层次结构鲜明,非常适合作为配置文件.PHP中可以使用DOM XML来操作XML.本文总结一下PHP使用DOM XML创建.添加节点.查询XML文件. 2.使用DOM XML XML ...

  5. 【转】以太网帧、IP报文格式

    原文:https://www.cnblogs.com/yongren1zu/p/6274460.html https://blog.csdn.net/gufachongyang02/article/d ...

  6. js获取当月最后一天

    构造函数 new Date(); new Date(value); new Date(dateString); new Date(year, month[, day[, hour[, minutes[ ...

  7. HTTP服务原理

    第1章 HTTP服务介绍 1.1 简述用户访网站流程 a 进行域名信息的DNS解析 dig +trace 获得www.oldboyedu.com ip地址信息 b 进行与网站服务器建立连接,tcp三次 ...

  8. JavaScript 时间、格式、转换及Date对象总结

    悲剧的遇到问题,从前台得到时间,“Tue Jan 29 16:13:11 UTC+0800 2008”这种格式的,想再后台解析成想要的格式,但是在后台就是解析不了SimpleDateFormat也试着 ...

  9. 微信小程序 - 深度定义骨架屏(提示)

    此举每个页面必须创建对应的css样式,比较麻烦(但非常准确),推荐使用组件化的skeleton组件 原理很简单:知晓一下this.setData原理,就OK了,可能大家会因此了解到全屏加载loadin ...

  10. 磁盘I/O的性能评估方法

    磁盘I/O的性能评估方法 http://blog.synology.com/blog/?p=2086 通常,我们很容易观察到数据库服务器的内存和CPU压力.但是对I/O压力没有直观的判断方法.磁盘有两 ...