开发学院手机开发iPhone 开发 在iPhone开发中给键盘加个隐藏工具条 阅读

在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;}

[[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];

上一页  1 2 3 4 5  下一页

Tags:iPhone 开发 键盘

编辑录入:爽爽 [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接