在iPhone开发中给键盘加个隐藏工具条
2010-12-18 08:06:24 来源:WEB开发网[[TextFields objectAtIndex:num-1 ] becomeFirstResponder];
[self ShowBar:[TextFields objectAtIndex:num-1]];
}
}
//显示下一项
-(void)ShowNext{
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<[TextFields count]-1){
[[TextFields objectAtIndex:num] resignFirstResponder];
[[TextFields objectAtIndex:num+1] becomeFirstResponder];
[self ShowBar:[TextFields objectAtIndex:num+1]];
}
}
//显示工具条
-(void)ShowBar:(UITextField *)textField{
currentTextField = textField;
if (allowShowPreAndNext) {
[view setItems:[NSArray arrayWithObjects:prevButtonItem,nextButtonItem,spaceButtonItem,hiddenButtonItem,nil]];
}
else {
[view setItems:[NSArray arrayWithObjects:spaceButtonItem,hiddenButtonItem,nil]];
}
if (TextFields==nil) {
prevButtonItem.enabled = NO;
nextButtonItem.enabled = NO;
}
else {
NSInteger num = -1;
for (NSInteger i=0; i<[TextFields count]; i++) {
if ([TextFields objectAtIndex:i]==currentTextField) {
num = i;
break;
}
}
if (num>0) {
prevButtonItem.enabled = YES;
}
else {
prevButtonItem.enabled = NO;
}
if (num<[TextFields count]-1) {
nextButtonItem.enabled = YES;
}
else {
nextButtonItem.enabled = NO;
}
}
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
- ››开发学院教你用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
更多精彩
赞助商链接