如何解决键盘遮挡 UITextField的问题?

查看源码

可以将遮住的界面移动到。软键盘出来的时候就将界面移动,输入完成,移回到原来的位置

[cc lang=”c”]

-(BOOL)textFieldShouldReturn:(id)sender

{

self.view.center = CGPointMake(240,160);

[sender resignFirstResponder];

return YES;

}

- (BOOL)textFieldShouldBeginEditing:(id)sender

{

if(sender==emailText)

{

self.center=CGPointMake(self.center.x,80);

}

else if(sender==speechText)

{

self.center=CGPointMake(self.center.x,0);

}

return YES;

}

[/cc]