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 8451473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:15:02+00:00 2026-06-10T11:15:02+00:00

I am trying to update selected rows of UITableView from UIAlertView inside didSelectRowAtIndexPath .

  • 0

I am trying to update selected rows of UITableView from UIAlertView inside didSelectRowAtIndexPath. But I am facing a problem. Each time I try to update any row, it’s only updates the first row irrespective of selection of row.
My code is:

 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

NSString *selectedrow = nil;

if (searching) {
    slCell=indexPath.row;
    selectedrow = [copyListOfItems objectAtIndex:indexPath.row];


UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Enter the Number of Quantity" message:@""
                                               delegate:self cancelButtonTitle:nil  otherButtonTitles:@"OK", nil];

[alert addTextFieldWithValue:@"" label:@"Number of Item"];  
textfieldQty = [alert textFieldAtIndex:0];
textfieldQty.keyboardType = UIKeyboardTypeNumberPad;
textfieldQty.keyboardAppearance = UIKeyboardAppearanceAlert;
textfieldQty.autocorrectionType = UITextAutocorrectionTypeNo;
[alert show];
[alert release];
}
else {

    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Enter the Number of Quantity" message:@""
                                                   delegate:self cancelButtonTitle:nil  otherButtonTitles:@"OK", nil];

    [alert addTextFieldWithValue:@"" label:@"Number of Item"];  
    textfieldQty = [alert textFieldAtIndex:0];
    textfieldQty.keyboardType = UIKeyboardTypeNumberPad;
    textfieldQty.keyboardAppearance = UIKeyboardAppearanceAlert;
    textfieldQty.autocorrectionType = UITextAutocorrectionTypeNo;
    [alert show];
    [alert release];
        }
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
NSString *b=nil;
if (buttonIndex == 0) {
    if (searching) {
        if([textfieldQty.text isEqualToString:b]) {
            UIAlertView *alert2 = [[UIAlertView alloc] initWithTitle:@"Enter plz" message:@""
                                                           delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK"];
            [alert2 show];
            [alert2 release];
        }


    NSString *newqty = [[NSString alloc] initWithFormat:@"%@",textfieldQty.text];
    DMSAppDelegate *d= (DMSAppDelegate *)[[UIApplication sharedApplication] delegate];

    [d->tableDataQt replaceObjectAtIndex:slCell withObject:(id)newqty];

    NSLog(@"tb%@",copyListOfQty);

    }
    else {

        NSString *newqty = [[NSString alloc] initWithFormat:@"%@",textfieldQty.text];
        DMSAppDelegate *d= (DMSAppDelegate *)[[UIApplication sharedApplication] delegate];
        [d->tableDataQt replaceObjectAtIndex:slCell withObject:(id)newqty];
        [self.tablevieww reloadData];
    }

}   
}
  • 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-10T11:15:03+00:00Added an answer on June 10, 2026 at 11:15 am

    Please follow below steps to achieve what you want.

    1. While creating UIAlertview in (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath method, set alerview’s tag as indexpath’s row.
    2. In delegate method -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex, you try to access alertView’s tag and pass that tag to the method call [d->tableDataQt replaceObjectAtIndex:[alertView tag] withObject:(id)newqty];
    3. In AppDelegate class, you create one more method called -(void)replaceObjectAtIndex:(NSInteger>inIndex withObject:(id)inObject
    4. In above newly created method try to access UITableViewCell from UITableView object with method call UITableViewCell *myCell = [tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:inIndex inSection:0];
    5. This way, you will get the object of UITableViewCell and alter the value of that and reload the table.

    I hope this will help you. Please do not forget to put right mark if this resolves your problem. 🙂

    Thanks.

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

Sidebar

Related Questions

I trying to update a model on a callback but the validation is causing
When trying to update a subversion working copy from Netbeans, I get the following
I`m trying to update time in datetime field as UPDATE table_name SET col_name=to_DATE('04/02/2012 00:12:00','MM/DD/YYYY
I am trying to update a database with values from a csv file, the
I am trying to update some local access databases from a web database. When
I have a Crystal Report I'm trying to recreate from scratch after an update
I am using asp.net membership and trying to update a users details but get
I am trying to edit and update a selected users details, following the tutorial
I'm trying to update the text in a textbox when a value is selected
I am currently trying to update a textbox using an 'onclick' event inside a

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.