我想,当用户浏览我的tableview跳过被禁用的文本字段。但是,当它们到达可见单元格的边界时,所有内容都会因为尝试检测文本字段是否被禁用而出现问题,如果是,则再次递归调用我的方法以再次导航。即。如果用户按下按钮导航到右侧,并且该文本字段被禁用,则递归地再次调用右侧按钮。UITextField,用于细胞不可见已经userInteractionEnabled设置为无
看来,外面有什么可见的细胞的任何文本字段将被禁用。一旦用户到达桌子的边缘,我会进入无限循环,或者事情刚刚破裂。
这里是我的代码,我做我的启用检查,如果没有让我的递归调用部分。这真的不应该那么复杂。从逻辑上讲,我想要做的就是检测我们刚刚移动到的文本字段是否被禁用,如果是,则再次启动相同的按钮。没有什么花哨。
编辑有些游戏测试显示nextTextFieldSelection返回为null,虽然destinationIndexPath和newTag值是正确的。是否有可能请求indexPath不可见正在导致null返回?
//logic to move to next text field and manually scroll the tableViewbased on button input is here
nextTextFieldSelection = (UITextField *)[[_tableView cellForRowAtIndexPath:destinationIndexPath] viewWithTag:newTag];
if (nextTextFieldSelection.userInteractionEnabled == NO) {
switch (arrowButton.tag) {
case NumericKeyboardViewLeftArrow:
currentTextField = nextTextFieldSelection;
[self numericKeyboardView:(VS_NumericKeyboardView *)numericKeyboardView DidSelectArrowButton:(UIButton *)arrowButton];
return;
case NumericKeyboardViewRightArrow:
currentTextField = nextTextFieldSelection;
[self numericKeyboardView:(VS_NumericKeyboardView *)numericKeyboardView DidSelectArrowButton:(UIButton *)arrowButton];
return;
default:
break;
}
}
你每次调用'numerKeyboardView后更改标签? – Rakesh 2013-02-28 16:24:36
是的,在我的逻辑改变文本字段,左边或右边的文本字段标签取决于用户如何浏览 – JMD 2013-02-28 16:27:10
你所谈论的nextTextFieldSelection的标签正确设置? – Rakesh 2013-02-28 16:31:34