我想,當用戶瀏覽我的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