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

  • Home
  • SEARCH
  • 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 8466295
In Process

The Archive Base Latest Questions

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

I am using a UITableView to show data, and by using customise button and

  • 0

I am using a UITableView to show data, and by using customise button and delete function I am trying to delete selected row. But i want to put an alertview inside that function when UITableView is empty, and by using buttons inside the UIAlertView I am trying to navigate to main page and previous page according to conditions. But it’s getting crashed after UITableView is getting empty and I push the delete button with “Program received signal: “SIGABRT”.

My code looks like this:

    - (IBAction)DeleteButtonAction:(id)sender
    {   
        DMSAppDelegate *d = (DMSAppDelegate *)[[UIApplication sharedApplication] delegate];

        NSLog(@"Message From Custom Cell Received");

        if(d->newtableData.count != 0)
        {

            NSIndexPath *indexPath = [self.tablevieww2 indexPathForCell:(UITableViewCell *)[[[sender superview] superview] superview]];
            NSUInteger row = [indexPath row];
            [d->newtableDataQt removeObjectAtIndex:row];
            NSLog(@"data removed");
            [self.tablevieww2 reloadData];
        }   
        else
        {       
            UIAlertView *alertview=[[UIAlertView alloc] initWithTitle:@"hello" message:@"Warning!!: Table is empty" delegate:self cancelButtonTitle:@"Yes" otherButtonTitles:@"",@"No",nil];
            textfieldQty1 = [alertview textFieldAtIndex:0];
            textfieldQty1.keyboardType = UIKeyboardTypeNumberPad;
            textfieldQty1.keyboardAppearance = UIKeyboardAppearanceAlert;
            textfieldQty1.autocorrectionType = UITextAutocorrectionTypeNo;
            [alertview show];
            [alertview release];    
        }

    }

    - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex 
    {
        if (buttonIndex == 0) 
        {
            DMSViewController *bt=[[DMSViewController alloc]initWithNibName:nil bundle:nil];
            bt.modalTransitionStyle=UIModalTransitionStyleCrossDissolve;
            [self presentModalViewController:bt animated:YES];
        }
        else if (buttonIndex == 1)
        {
            NSString *newqty = [[NSString alloc] initWithFormat:@"%@",textfieldQty1.text];
            DMSAppDelegate *d= (DMSAppDelegate *)[[UIApplication sharedApplication] delegate];
            [d->newtableDataQt replaceObjectAtIndex:slCell1 withObject:(id)newqty];
            NSLog(@"tb%@",d->newtableDataQt);
            [self.tablevieww2 reloadData];  
            int total1=0;

            for ( int i=0 ; i < [d->newtableDataQt count];++i )
            {           
                NSString *string = [d->newtableDataQt objectAtIndex:i];

                NSLog(@"string%@",string);

                if ([string isEqualToString:@"0"])
                {

                }
                else
                {
                    NSLog(@"newArray%@",d->newtableDataPrice);
                    NSString *strP=[d->tableDataPrice objectAtIndex:i];
                    NSInteger sp=[strP integerValue];
                    NSInteger st=[string integerValue];
                    total1=total1+st*sp;
                    NSLog(@"total1%d",total1);
                }
            }

            NSString *newtotal1=[NSString stringWithFormat:@"%d",total1];
            DMSAppDelegate *d2 = (DMSAppDelegate   *) [[UIApplication sharedApplication] delegate];
            d2->totalD = [[NSString alloc] initWithString:newtotal1];
        }   
    }

    Please give me some solution. I am trying really hard from yesterday but not getting any success.
    Thanks in advance.
    @
  • 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-10T15:18:04+00:00Added an answer on June 10, 2026 at 3:18 pm

    You need to check two things:-

    First:- if(d->newtableData.count != 0)
    is the condition and you are not removing the items from newtableData you are removing it from newtableDataQt so thats why your else method is not getting called. because newtableData will never have count =0.

    Second thing;-
    one thing if your table is empty means that newtableDataQt will contain no values , it will be empty.Now when you click on the delete button, the alert view appears , after that if you click whatever button at index 1 then in your code you have written :-

    [d->newtableDataQt replaceObjectAtIndex:slCell1 withObject:(id)newqty];
    

    so newtableDataQt has already be empty before and now you are using it.This might be the reason of crash.

    try

    if( [newtableDataQt count] >slCell1)
    {    [d->newtableDataQt replaceObjectAtIndex:slCell1 withObject:(id)newqty];
    }
    

    I hope it might help you.

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

Sidebar

Related Questions

How to show a detail disclosure button to the uitableview without using the custom
I am using custom UITableview concept to show data in cell of tableview. My
I am using Core Data to show data in a table view, but I
I'm using NSFetchedResultsController to retrieve data for a UITableView . but problem is I
I'm using a UITableView to show some data from an array. This array can
I want to create a view that shows vast amounts of data. Using UITableView
I'm using a UITableView control to show some data that can be edited by
I am setting the row height of my UITableView using following code [tableView setRowHeight:
I'm trying to build a menu using a UItableView with Custom cells which have
Apple's documentation on UITableView discusses how to add/edit/delete rows, but it doesn't discuss adding/editing/deleting

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.