実際には、次のボタンと前のボタンを使って別のセルに移動し、各セルにテキストフィールドがあるので、次のボタンをクリックすると、次のセルに移動し、このセル参照を取得することでテキストフィールドを最初のレスポンダーですが、前のボタンをクリックしているときに参照が返されません。 iは次および前に使用していたコードがUITableViewCellにあるUITextFieldの参照を取得していますか?
- (IBAction)nextPrevious:(id)sender
{
NSIndexPath *indexPath ;
BOOL check = FALSE;
if([(UISegmentedControl *)sender selectedSegmentIndex] == 1){
if(sectionCount>=0 && sectionCount<8){
//for next button
check = TRUE;
sectionCount = sectionCount+1;
indexPath = [NSIndexPath indexPathForRow:0 inSection:sectionCount];
}
}else{
//for previous button
if(sectionCount>0 && sectionCount<=9){
check = TRUE;
sectionCount = sectionCount-1;
indexPath = [NSIndexPath indexPathForRow:0 inSection:sectionCount];
}
}
if(check == TRUE){
//[registrationTbl reloadData];
UITableViewCell *cell = [registrationTbl cellForRowAtIndexPath:indexPath];
for(UIView *view in cell.contentView.subviews){
if([view isKindOfClass:[UITextField class]]){
[(UITextField *)view becomeFirstResponder];
break;
}
}
[registrationTbl scrollToRowAtIndexPath:indexPath
atScrollPosition:UITableViewScrollPositionTop
animated:YES];
// UITextField *field = (UITextField *) [cell.contentView viewWithTag:indexPath.section];
// [field becomeFirstResponder];
}
下に与えられる任意の小さな提案がはるかに理解されるであろう。事前に感謝します
ありがとうございました、ありがとうございました。それは私のために働いた。 –