在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];
- ››开发Android 日历教程
- ››开发学院总结 Win 8实用技巧大全
- ››开发学院原创教程:把win8的IE10放桌面上方法(非...
- ››iphone图片拉伸的几种方法
- ››iphone正则表达式的简单使用
- ››iPhone开发Unresolved Symbols CAKeyframeAnimati...
- ››IPhone开发-“此证书是由未知颁发机构签名”解决方...
- ››IPhone开发-整合私钥和证书,生成.p12文件
- ››iPhone应用开发-UIPickerView选取器详解
- ››iphone 获取屏幕的宽度和高度
- ››iPhone读取工程包中的二进制文件
- ››键盘样式风格有关设置
更多精彩
赞助商链接