如何使用iPhone SDK获取视图上的控件列表? [英] How get the list of controls on a view with iPhone SDK?
本文介绍了如何使用iPhone SDK获取视图上的控件列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在填写表格时做类似safari应用程序的操作,所以当用户看到键盘时,下一步要做的就是移至下一个控件.
I wanna do something like the safari app when fill a form, so when the user see the keyboard do next and move to next control.
现在,我如何获得下一个文本控件?
Now, how I get the next text control?
推荐答案
您可以在 textFieldShouldReturn:中处理此类行为 每当用户点击回车键时,这都将使您的注意力集中在表单上.
You can handle behaviour like this in textFieldShouldReturn: This should move your focus along the form for you each time the user hits return.
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
if(textField == field1) {
[field1 resignFirstResponder];
[field2 becomeFirstResponder];
// do stuff with field1 text
} else if(textField == field2) {
[field2 resignFirstResponder];
[field3 becomeFirstResponder];
// do stuff with field2 text
} // and so on
}
这篇关于如何使用iPhone SDK获取视图上的控件列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文