下载地址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. java正则校验,密码必须由字母和数字组成

    一个匹配数字和字母密码的正则表达式 2011 年 12 月 14 日 | Filed under: 正则表达式 and tagged with: 密码 , 正则表达式 , 零宽断言 一个用户注册功能的 ...

  2. checkbox反复调用attr('checked', true/false)只有第一次生效

    /** * 全选 */ function checkAll() { $("input[name=ids]").attr("checked", true); } ...

  3. 屌丝就爱尝鲜头——java8初体验

    Java8已经推出,让我们看看他的魅力.让我们看看他改变较大的部分. 一.java8概述 Java8是由Oracle(甲骨文)公司与2014年3月27日正式推出的.Java8同时推出有3套语言系统,分 ...

  4. 仿qq底部的提示标记

    看到一个比較不错的开源项目,分享给大家: <?xml version="1.0" encoding="utf-8"?> <RelativeLa ...

  5. Tensorflow中张量数据类型的转换

    https://blog.csdn.net/Tramac/article/details/74942587 字符串转为数字: tf.string_to_number (string_tensor, o ...

  6. OAuth2 Demo PHP

    OAuth2 Demo PHP 此应用程序的目的是演示OAuth2.0客户端和服务器之间的工作流.如果这是你第一次来这里,试图尝试的现场演示让OAuth2.0流更好的感觉. experimenting ...

  7. mysqli

    CREATE TABLE `user` ( `id` ) NOT NULL, `name` ) NOT NULL, `password` ) NOT NULL ) ENGINE=InnoDB DEFA ...

  8. 编码GBK的不可映射字符

    1.错误描写叙述 [ERROR] /E:/Eclipse/workspace/huxs/src/test/java/com/you/huxs/utils/SpringTestBase.java:[14 ...

  9. ActiveMQ持久化方式

    ActiveMQ持久化方式 发表于8个月前(2014-09-04 15:55)   阅读(686) | 评论(0) 17人收藏此文章, 我要收藏 赞1 慕课网,程序员升职加薪神器,点击免费学习 摘要  ...

  10. apache 反向代理的时候,通过域名访问是,出现跳转到ip或者无权访问的情况

    解决方法很简单,在配置反向代理的时候加上一行: ProxyPreserveHost On 例如:ProxyPass / http://202.112.0.1/ProxyPassReverse / ht ...