下载地址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. linux中断

    [一].中断底半部 1. 软中断    --->>>  执行在中断上下文  --->>>  会被中断打断,不会被软中断或进程打断  --->>> ...

  2. 如何大幅优化solr的查询性能(转)

    提升软件性能,通常喜欢去调整各种启动参数,这没有多大意义,小伎俩. 性能优化要从架构和策略入手,才有可能得到较大的收益 Solr的查询是基于Field的,以Field为基本单元,例如一个文章站要索引 ...

  3. mybatis plus 主键生成 Twitter雪花算法 id 及修改id为字符型

    mybatis plus配置主键生成策略为2,就是 使用Twitter雪花算法 生成id spring boot中配置为: GlobalConfiguration conf = new GlobalC ...

  4. 根据ip地址获取用户所在地

    java代码: package com.henu.controller; import java.io.BufferedReader; import java.io.IOException; impo ...

  5. JAVA-SpringMVC基于注解模式第一个应用

    项目文件结构 1. web.xml配置文件 <?xml version="1.0" encoding="UTF-8"?> <web-app x ...

  6. Android Fragment的使用(转载)

    可以分为下面的几部分: 使用支持库 创建一个Fragment 创建一个动态UI 多个Fragment之间的通信 1.使用支持库 如果您的应用需要运行在3.0及以上的版本,可以忽略这部分内容. 如果您的 ...

  7. OpenNebula学习第三节之虚拟机管理

    一.背景 已经安装好OpenNebula-Front-end 已经安装好OpenNebula Node 已经把Node注册到Front-end 二.目标 看过第一.二节的同学们可能已经知道我的整个环境 ...

  8. [Javascript] Check both prop exists and value is valid

    Sometime you need to check one prop exists on the object and value should not be ´null´ or ´undefine ...

  9. 分享几套生成iMac相关高逼格免费mockup的素材和在线工具

    好久没有过来转, 今天姐姐我分享几套高逼格的iMac相关设计资源, 希望各位靓妹帅哥会喜欢, 最重要滴是,都是FREE,此处应有掌声~~~ , yeah!! iMac桌面效果Mockup 只需要下载后 ...

  10. 解决IE兼容模式的方案

    在html头 加标签 强制使用最新的ie渲染 <meta http-equiv="X-UA-Compatible" content="IE=edge"&g ...