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: 一个带输入的对话框,可以返回用户填入的 ...
随机推荐
- go语言之进阶篇JSON处理
一.JSON处理 JSON (JavaScript Object Notation)是一种比XML更轻量级的数据交换格式,在易于人们阅读和编写的同时,也易于程序解析和生成.尽管JSON是JavaScr ...
- Doxygen简单经验谈。。。
Doxygen,大名鼎鼎的文档生成工具,被Boost.OpenCasCade等诸多项目作为文档生成的不二人选.人说,才华横溢往往是高深莫测,这句话放在 Doxygen这里显然是不适用的.十八般武艺样样 ...
- C语言头文件的使用(转载)
C语言头文件的使用 ——by janders 转载请注名作者和出处,谢谢! C语言中的.h文件和我认识由来已久,其使用方法虽不十分复杂,但我却是经过了几个月的“不懂”时期,几年的“一知半解”时期才逐渐 ...
- Android 资源混淆 AndResGuard MD
Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...
- Gson Json 序列号 最常用的功能 MD
Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...
- 大数据开发实战:离线大数据处理的主要技术--Hive,概念,SQL,Hive数据库
1.Hive出现背景 Hive是Facebook开发并贡献给Hadoop开源社区的.它是建立在Hadoop体系架构上的一层SQL抽象,使得数据相关人员使用他们最为熟悉的SQL语言就可以进行海量数据的处 ...
- 【Scala】Scala-Map使用方法
Scala-Map使用方法 scala map put_百度搜索 Scala中的Map使用例子 - CSDN博客 How to populate java.util.HashMap on the fl ...
- python 字符串操作常用函数总结
说明:并不完善,只是记录自己使用到的,没使用到或会用的不会出现在本文. 1.字符串截取 (1)基于索引 s = 'ilovepython' s[0]='i' s[-1] = 'n' (2)取其中一段 ...
- 将iPhone投影到Mac上
将iPhone投影到Mac上 有时候, 出于演示须要, 又或者嫌弃iPhone屏幕太小了, 我想把画面弄到mac上. 这时候, 就须要将iPhone投影到Mac上. 至于怎样做呢? 这就是本文要说明的 ...
- Return array from functions in C++
C++ does not allow to return an entire array as an argument to a function. However, you can return a ...