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语言之进阶篇 netcat工具的使用
一.netcat工具的使用 1.先安装netcat软件,再配置环境变量 2.tcp服务器代码 示例: package main import ( "fmt" "net&q ...
- Datetimepicker配置参数
jquery的datetimepicker时间控件除了样式有点不太美观,功能性还是相当强大的. 在正常情况下input的type应该设置为"text",可点击又可输入(mask,e ...
- 原生JS实现bind()函数
一.bind()函数的两个特性: 1.bind和curring,函数科里化 function add(a, b, c) { var i = a+b+c; console.log(i); return ...
- (转载)Java8新的日期API LocalDate, LocalTime
前言 由于Java Date的各种问题,Java8推出了新的日期API,很受一拨人的追捧. 为什么我们需要新的Java日期/时间API? 在开始研究Java 8日期/时间API之前,让我们先来看一下为 ...
- Office WPS如何在页眉页脚添加一条横线
点击样式,页眉,修改 然后设置格式,可以添加一条或者两条横线,也可以设置不同的线型 最后效果如下图所示
- 报错信息:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
用Eclipse创建jsp页面时,提示这个错误 解决的方法是:右键项目,Build Path->Configure Build Path Add Library Server Runtime,这 ...
- Javascript网页特效开发技巧
Javascript网页特效开发技巧 相信很多人跟我一样,做网站开发已经有两到三年了,但大部分时间还是复制别人的代码,虽然能看懂别人的代码,同时也觉得别人写的代码很简单,但自己却写不出来: 我总结了一 ...
- c++10进制转换为任意2-16进制数字
#include<stdio.h> #include<stdlib.h> #include<iostream> using namespace std; int m ...
- webapck 速度优化策略
一.概述 1.使用高版本Webpack 2.多进程/多实例构建 3.分包 4.缓存 5.缩小构建目标 二.多进程/多实例构建 (1)happypack happypack:https://www.np ...
- 如何查看页面是否开启gzip压缩
F12 选择Network 表头右键: 如果开启了gzip则显示gzip,没有则是空. 上图是百度首页,显示已经进行gzip压缩.