下载地址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. [leetcode]Remove Duplicates from Sorted Array II @ Python

    原题地址:https://oj.leetcode.com/problems/remove-duplicates-from-sorted-array-ii/ 题意: Follow up for &quo ...

  2. [leetcode]Pascal's Triangle II @ Python

    原题地址:https://oj.leetcode.com/problems/pascals-triangle-ii/ 题意: Given an index k, return the kth row ...

  3. iOS开发-UICollectionView实现瀑布流

    关于瀑布流的实现网上有很多种解法,自定义控件,TableView+ScrollView,UICollectionView是iOS6发布之后用于展示集合视图,算起来已经发布三年左右了,不过知识点是不变的 ...

  4. Vue上传图片预览组件

    父组件: <template> <div> <h4>基于Vue.2X的html5上传图片组件</h4> <div style="widt ...

  5. MFC中页面设置对话框CPageSetupDialog

    void CCPageSetupDialogView::OnPageSetting() { CPageSetupDialog dlg; // 利用默认参数构造页面设置对话框 if(dlg.DoModa ...

  6. python 爬虫随机获取User-Agent

    可以有两种方法: 1.随机生成 首先安装 pip install fake-useragent import random from fake_useragent import UserAgent d ...

  7. Shark简介、部署及编译小结

    http://blog.csdn.net/pelick/article/details/11964291 Shark简介 Shark即Hive on Spark,本质上是通过Hive的HQL解析,把H ...

  8. Fragment的setUserVisibleHint方法实现懒加载,但setUserVisibleHint 不起作用?

    我们在做应用开发的时候,一个Activity里面可能会以viewpager(或其他容器)与多个Fragment来组合使用,而如果每个fragment都需要去加载数据,或从本地加载,或从网络加载,那么在 ...

  9. Spring Boot中Starter是什么

    比如我们要在Spring Boot中引入Web MVC的支持时,我们通常会引入这个模块spring-boot-starter-web,而这个模块如果解压包出来会发现里面什么都没有,只定义了一些POM依 ...

  10. PD 之 连接数据库并导出数据及生成PDM文件

    使用PowerDesigner工具,连接数据库并导出数据及生成PDM文件. 1.建立连接 “以管理员身份运行”打开PowerDesigner,右键“Workspace”→“New”→“Physical ...