在iPhone开发中给键盘加个隐藏工具条
2010-12-18 08:06:24 来源:WEB开发网//
// Created by walkman on 10-12-2.
// Copyright 2010 手机主题下载 http://www.shouji138.com All rights reserved.
//
#import "KeyBoardTopBar.h"
@implementation KeyBoardTopBar
@synthesize view;
//初始化控件和变量
-(id)init{
if(self = [super init]) {
prevButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"上一项" style:UIBarButtonItemStyleBordered target:self action:@selector(ShowPrevious)];
nextButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"下一项" style:UIBarButtonItemStyleBordered target:self action:@selector(ShowNext)];
hiddenButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"隐藏键盘" style:UIBarButtonItemStyleBordered target:self action:@selector(HiddenKeyBoard)];
spaceButtonItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem: UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
view = [[UIToolbar alloc] initWithFrame:CGRectMake(0,480,320,44)];
view.barStyle = UIBarStyleBlackTranslucent;
view.items = [NSArray arrayWithObjects:prevButtonItem,nextButtonItem,spaceButtonItem,hiddenButtonItem,nil];
allowShowPreAndNext = YES;
TextFields = nil;
isInNavigationController = YES;
currentTextField = nil;
}
return self;
}
//设置是否在导航视图中
-(void)setIsInNavigationController:(BOOL)isbool{
isInNavigationController = isbool;
}
//显示上一项
-(void)ShowPrevious{
if (TextFields==nil) {
return;
}
NSInteger num = -1;
for (NSInteger i=0; i<[TextFields count]; i++) {
if ([TextFields objectAtIndex:i]==currentTextField) {
num = i;
break;
}
}
if (num>0){
[[TextFields objectAtIndex:num] resignFirstResponder];
- ››开发学院教你用SQL 语句最快速清空MySQL 数据表的...
- ››iPhone应用帮助残障儿童看图说话
- ››iPhone实用工具AppBox Pro使用教程大揭秘
- ››iphone4省电方法
- ››iphone 获取地址的详细信息
- ››iPhone 库的基本内存管理策略
- ››iPhone加密文字亲手做 私密信息有保障
- ››iphone 根据经纬度坐标取详细地址(包括国,省,市...
- ››iphone/ipad ios cocoa object-c 近期苹果UI部分小...
- ››iphone中如何进行多线程编程
- ››iPhone OS SDK的这些事[安装、下载、版本、实例、...
- ››iPhone ObjectC的NSAutoreleasePool
更多精彩
赞助商链接