で検証を行っていUITableViewCell
ます。セルにはtextView
とカスタムボタンがあり、クリックすると、を含むポップオーバーがUIDatePickerView
開き、ユーザーが日付を選択します。ここで日付の選択は必須です。そこで、以下のコードを使用して検証を行いました。すぐ次の行のセル内のtextViewBeginEditing
デリゲートメソッド。textView
つまり、ユーザーが次の行をクリックするとtextView
、前の行の値が検証されます。ここでは、検証は機能しているように見えますが、カーソルは現在のセルでまだ点滅しており、検証されている前のセルに移動しません。
UITableViewCell* myCell = (UITableViewCell*)textView.superview ;
UITextView *txtviewMycelltext;//=[[UITextView alloc]init];
for (UIView *view in myCell.subviews)
{
if([view isKindOfClass:[UILabel class]])
{
UILabel *lbl=view;
lbl.text=[lbl.text stringByReplacingOccurrencesOfString:@"." withString:@""];
int tablerowindex=[lbl.text intValue];
NSLog(@"%@",lbl.text);
break;
}
if([view isKindOfClass:[UITextView class]])
{
txtviewMycelltext=view;
}
}
inttablerowindex-=1;
if(inttablerowindex>0)
{
if([[arrActionvalues objectAtIndex:inttablerowindex1]objectForKey:KEY_FOLLOWUPDATE]==EMPTYSTRING)
{
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle: @"Alert"
message: ALERT_FOLLOWUPDATE
delegate: nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
// UITableView *mytable=(UITableView *)((textView.superview).superview).superview;
UITableView *myTable=(UITableView*)[[myCell superview]superview];
NSIndexPath *indexPath = (NSIndexPath*)[myTable indexPathForCell:
(UITableViewCell*)textView.superview.superview];
UITableViewCell *previousCell = (UITableViewCell*)[myTable cellForRowAtIndexPath:[NSIndexPath indexPathForRow:indexPath.row - 1 inSection:indexPath.section]];
for (UIView *view in previousCell.subviews)
{
NSLog(@"%@",view);
if([view isKindOfClass:[UIView class]]) {
UIView *subView=view;
for(UIView *view2 in subView.subviews)
{
if([view2 isKindOfClass:[UITextView class]]) {
UITextView *txt=view2;
[txtviewMycelltext resignFirstResponder];
[txt becomeFirstResponder];
break;
}
}
}
}
}
}
カーソル位置を正しいセルに移動するために何をする必要があるか教えてください。