Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8983437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:50:28+00:00 2026-06-15T20:50:28+00:00

We are doing a validation in a UITableViewCell . The cell has a textView

  • 0

We are doing a validation in a UITableViewCell. The cell has a textView and a custom button on clicking which a pop over containing a UIDatePickerView should open & the user will select the date. Here selecting the date is mandatory. So we did a validation using the below code. In the textViewBeginEditing delegate method of the textView inside the cell in the immediate next row. i.e when the user clicks on the textView in the next row the previous row values will be validated.
Here the validation seems to be working but the cursor still blinks in current cell and do not move to the previous cell that is being validated.

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;
                              }
                          }


                      }
                  }
              }
          }

Please let me know what needs to be done to get the cursor position to the correct cell.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:50:29+00:00Added an answer on June 15, 2026 at 8:50 pm

    It is not very clear from you code, but, I am guessing you are performing your validations inside textViewDidEndEditing.

    textViewShouldEndEditing is the appropriate delegate method to perform validation of the text view contents. You can return NO if you want to prevent the switching of focus from the current text view.

    http://developer.apple.com/library/ios/#documentation/uikit/reference/UITextViewDelegate_Protocol/Reference/UITextViewDelegate.html#//apple_ref/occ/intfm/UITextViewDelegate/textViewShouldEndEditing:

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm unclear about when and how I should be doing validation in my custom
Although I have my php validation doing this, thought I may as well pop
I'm doing validation on a lengthy form using a custom attribute. One of the
As it says in the title, I'm doing custom validation with FCK (because the
I'm doing some validation and can't seem to get what should be a simple
I have a custom DataAnnotationsModelValidatorProvider for doing model validation in a more dynamic way
I am doing validation for Driver's Date of birth, it should be minimum of
I have custom list in sharepoint and I am doing validation through sharepoint designer
I have no idea why this doesn't work, but doing some validation functions and
I am doing some client side validation in ASP.NET MVC and I found myself

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.