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