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 ...
随机推荐
- Python笔记(十一)——数据抓取例子
上班时候想看股票行情怎么办?试试这个小例子,5分钟拉去一次股票价格,预警: #coding=utf-8 import re import urllib2 import time import thre ...
- javascript 公历与农历相互转换工具类
/** * 公历[1900-1-31,2100-12-31]时间区间内的公历.农历互转 * @charset UTF-8 * @Author Jea杨(JJonline@JJonline.Cn) * ...
- 利用JavaScript的%读分秒
<!doctype html> <html> <head> <meta charset="utf-8"> <title> ...
- hdu3926 Hand in Hand 判断同构
因为每个人小朋友只有两只手,所以每个点最多只有2度.图有可能是环.链,以及环和链构成的复杂图. 如何判断两幅图是否相似呢?判断相似是判断两幅图的圈的数量,以及构成圈的点数是否相同.还有判断链的数目和构 ...
- Approximate Nearest Neighbors.接近最近邻搜索
(一):次优最近邻:http://en.wikipedia.org/wiki/Nearest_neighbor_search 有少量修改:如有疑问,请看链接原文.....1.Survey:Neares ...
- 基于MapReduce的贝叶斯网络算法研究参考文献
原文链接(系列):http://blog.csdn.net/XuanZuoNuo/article/details/10472219 论文: 加速贝叶斯网络:Accelerating Bayesian ...
- 软件的描述x
1)文档描述: 2)模型描述: 3)架构描述: 4)代码描述:
- jq遍历 下拉框
var selectA1 = $("select[name=A1]"); //从A1下拉框中 搜索值 $(selectA1).children("option" ...
- macOS 不用任何第三方工具 简单两步使用 Automator 将截图转成@1x
制作 Automator 脚本 打开 Automator -> 选择服务,左侧搜索 shell,双击打开,右侧粘贴以下内容,将上部 服务收到... 改成 没有输入,CMD+S保存,名称就叫 屏幕 ...
- 优动漫PAINT新建文件
在优动漫PAINT软件中展开任何一项操作之前,都需要新建或打开图形文件.新建文件之后,用户可根据自己的需求进行相应的设置,这样将大大节省后期制作的时间! 在优动漫PAINT中新建图形文件的方法: 方法 ...