ios 导航栏 点击barbutton的按钮 下拉列表
环境:xocde5.0.2+ios7.0.1
1、导航栏 ----点击科目--------下拉列表
代码:NGRightTableViewViewController.h
#import <UIKit/UIKit.h>
@protocol PulldownMenuDelegate
-(void)menuItemSelected:(NSIndexPath *)indexPath;
-(void)pullDownAnimated:(BOOL)open;
@end
@interface NGRightTableViewViewController : UITableViewController<UITableViewDataSource,UITableViewDelegate>{
id<PulldownMenuDelegate> pulldelegate;
}
@property (nonatomic, retain) id<PulldownMenuDelegate> pulldelegate;
@property (nonatomic,strong) NSMutableArray *tableViewArray;
@property (nonatomic,strong) NSString *cellString;
-(NSString *) cellString;
@end
NGViewController.h的代码:
#import <UIKit/UIKit.h>
#import "NGRightTableViewViewController.h"
@interface NGViewController : UIViewController<PulldownMenuDelegate>
//- (IBAction)jumpBut:(id)sender;
@property (nonatomic, retain) NGRightTableViewViewController *rtvv;
@end
.m部分代码:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
// UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:viewController];
mArray=[[NSMutableArray alloc] initWithObjects:@"uuuuuu",@"qqqu",@"qqqq",@"rrrr",@"yyyyy", nil];
UIButton *secondBut=[[UIButton alloc] initWithFrame:CGRectMake(120, 340, 40, 40)];
[secondBut setTintColor:[UIColor blueColor]];
[secondBut setTitle:@"第二" forState:UIControlStateNormal];
[secondBut setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
secondBut.titleLabel.font = [UIFont fontWithName:@"System-Bold" size:25.0f];
[secondBut addTarget:self action:@selector(jumpBut:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:secondBut];
UIBarButtonItem *leftBarBtn = [[UIBarButtonItem alloc] initWithTitle:@"触摸" style:UIBarButtonItemStyleBordered target:self action:@selector(leftBarBtnClicked:)];
self.navigationItem.leftBarButtonItem = leftBarBtn;
UIBarButtonItem *rightBarBtn = [[UIBarButtonItem alloc] initWithTitle:@"科目" style:UIBarButtonItemStyleBordered target:self action:@selector(rightBarBtnClicked:)];
self.navigationItem.rightBarButtonItem = rightBarBtn;
if (rtvv==nil) {
rtvv=[[NGRightTableViewViewController alloc] init];
}
rtvv.tableViewArray=mArray;
// rtvv.view.frame=CGRectMake(0, 0, 320, 300);
rtvv.view.frame=CGRectMake(150, 64, 165, 120);
[self addChildViewController:rtvv];
[self.view addSubview:rtvv.view];
rtvv.pulldelegate=self;
[rtvv.view setHidden:YES];
// [self.view presentedViewController:rtvv.view];
// [self.. reloadData];
}
另外有:textField相应keywoard的高度自己主动适应: http://download.csdn.net/detail/shuang60/7927929
ios 导航栏 点击barbutton的按钮 下拉列表的更多相关文章
- iOS导航栏背景,标题和返回按钮文字颜色
在iOS7下,默认导航栏背景,颜色是这样的,接下来我们就进行自定义,如果你仅仅是更改一下背景和颜色,代码会很简单,不需要很复杂的自定义View来替代leftBarItem 更改导航栏的背景和文字Col ...
- IOS导航栏的使用方法
本文是使用纯代码实现一个导航栏的效果.单击按钮并且产生事件.基本思路是: 1.创建一个导航栏(UINavigationBar对象) 2.创建一个导航栏集合(UINavigationItem对象) 3. ...
- 转:ios导航栏设置
原帖:http://www.cocoachina.com/industry/20131104/7287.html 本文提供的代码需要用Xcode 5来执行.如果你还在使用老版本的Xcode,那么在运行 ...
- 通过HTML+CSS+Javascript实现向下滚动滚动条出现导航栏并出现回到顶部按钮点击按钮回到顶部(一)
回到顶部实例一 效果:默认隐藏导航栏,当滚动条滚到超过300px后导航栏和按钮出现,点击回到顶部按钮回到顶部,并隐藏导航栏和按钮(导航栏和按钮都是固定定位) <!doctype html> ...
- iOS导航栏NavigationBar的颜色,按钮和标题以及字体颜色
首先,层级关系: leftBarButtonItem.rightBarButtonItem.title都是加在UINavigationItem上的,UINavigationItem再加在Navigat ...
- 自定义iOS7导航栏背景,标题和返回按钮文字颜色
在iOS7下,默认导航栏背景,颜色是这样的,接下来我们就进行自定义,如果你仅仅是更改一下背景和颜色,代码会很简单,不需要很复杂的自定义View来替代leftBarItem 更改导航栏的背景和文字Col ...
- IOS 导航栏属性设置
IOS 7 以上系统导航栏: [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]]; // 返回按钮颜色 [UINaviga ...
- 【转】自定义iOS7导航栏背景,标题和返回按钮文字颜色 -- 不错不错!!
原文网址:http://blog.csdn.net/mad1989/article/details/41516743 在iOS7下,默认导航栏背景,颜色是这样的,接下来我们就进行自定义,如果你仅仅是更 ...
- 【转】 自定义iOS7导航栏背景,标题和返回按钮文字颜色
原文:http://blog.csdn.net/mad1989/article/details/41516743 UIBarButtonItem,navigationItem,backBarButto ...
随机推荐
- BZOJ 1116 并查集
思路: 如果 每个联通块 边数>=点数 就OK 用并查集搞 //By SiriusRen #include <cstdio> #include <cstring> #in ...
- 第4章 部署模式 Deployment Plan(部署规划)
已开发了基于组件的应用程序,该应用程序在逻辑上构造为多层结构,如 Three-Layered Services Application. 中所述.您希望将它分布到一组在物理上为多级结构的服务器上,如 ...
- css 中font属性知识点总结
一. font属性值可以继承.例如子元素可以继承父元素的行高,字体大小等等. 二.font属性可以进行连写:font: font-sytle font-weight font-size/line- ...
- CDR快速制作苹果手机照片小图标
本篇教程用CorelDRAW快速制作苹果手机照片小图标,在实现的过程中主要使用了旋转复制的方法,加之一些常用工具的用法处理,最后加上透明效果下的合并模式就好了,现在跟小编一起来看看详细的操作吧! 1. ...
- 路飞学城Python-Day79
27-url控制器之path方法 由于基于re_path的路径编写方式是重复性高的编写url,如果规则改变了,则对应的要去修改很多url,这样是很不方便的 所以采用Django2.0的path去编写u ...
- Python编码显示中文乱码
爬虫时出现问题: import requests data=requests.get('http://roll.news.sina.com.cn/')print(data.text) 输出结果中文显示 ...
- [luogu4310] 绝世好题 (递推)
传送门 题目描述 给定一个长度为n的数列ai,求ai的子序列bi的最长长度,满足bi&bi-1!=0(2<=i<=len). 输入输出格式 输入格式: 输入文件共2行. 第一行包括 ...
- Hadoop安装和使用
1.安装 1.1.下载hadoop-2.5.1.tar.gz 1.2.解压至安装目录 tar -zxv -f hadoop-2.5.1.tar.gz -C ../soft/ 1.3.配置hadoop相 ...
- 【UOJ#50】【UR #3】链式反应(分治FFT,动态规划)
[UOJ#50][UR #3]链式反应(分治FFT,动态规划) 题面 UOJ 题解 首先把题目意思捋一捋,大概就是有\(n\)个节点的一棵树,父亲的编号大于儿子. 满足一个点的儿子有\(2+c\)个, ...
- 【codeforces 724E】Goods transportation
[题目链接]:http://codeforces.com/problemset/problem/724/E [题意] 有n个城市; 这个些城市每个城市有pi单位的物品; 然后已知每个城市能卖掉si单位 ...