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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:28:42+00:00 2026-05-23T12:28:42+00:00

any ideas ? some sample code , or some advices will be welcome …

  • 0

any ideas ? some sample code , or some advices will be welcome … thx

// add bank to tableView
-(void)addBankFromList {

    if (notInList == nil) {

        UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Could not be added" message:@"Bank already in list" delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:nil, nil];

        [alert show];
        [alert release];

    }

    else {

//       [banksTableView insertRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:[banks count] inSection:0]] withRowAnimation:UITableViewRowAnimationLeft];
//        [banksTableView reloadData];
    }
}

// call addBankFromList method when button Add to List is touched .
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {

    [self addBankFromList];
}

#pragma mark UIPicker Delegate and DataSource methods
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {

    for (NSString *temp in banksNotInList) 
        if (temp == [arrayWithBanks objectAtIndex:row]) {

            notInList = [[NSMutableString alloc]initWithString:temp];


            NSLog(@"%@",temp);
        }
        else notInList = nil;
}

SOLVED (read first comment)

[appDelegate.banks insertObject:notInList atIndex:[appDelegate.banks count]];
        [banksTableView insertRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:[banks count] inSection:0]] withRowAnimation:UITableViewRowAnimationLeft];

        [banksTableView 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-05-23T12:28:42+00:00Added an answer on May 23, 2026 at 12:28 pm

    It looks like you’ve got the right idea. Logically, you will want to check to see if the object already exists in the table (which you’re already doing). Then if it’s not in, you’ll insert it. That’s where trouble can arise if you’re not too familiar with udpating tableViews. What you’re doing above is the right start. You want to create an indexPath where you’d like to insert the new object, but there are a few steps you want to take before actually inserting the new row. You must have your numberOfRowsInSection match up with the updated number, so if you are drawing that return from an array, you need to update the array. So assuming you have banks as your array from which you’re displaying the tableView cells, you would insert the new object into the array at its respecitve position, then call insertRowsAtIndexPaths:withRowAnimation:. That way when the tableView calls its dataSource methods, it won’t have conflicting results. So in short, you update your data array, then update the tableView. I hope that all makes sense

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

Sidebar

Related Questions

I am looking for some sample JavaScript code that will allow me to have
I am trying to get some sample code on how I would add rows
Any ideas why on some links that I try to access using HttpWebRequest I
I am having some trouble trying to print from a file. Any ideas? Thanks
I have some code that does something like this (Irrelevant bits snipped): void foo(Bitmap
Here is some sample code to illustrate the problem I am having. #include <iostream>
I see addthis has some sample code that may help: http://www.addthis.com/help/client-api#events In my registration
I dont have time right this second to put some sample code, (Ill edit
Here is some sample code of how I am creating/connecting/working with my database string
Any idea how I express 'implements' in UML? I'm trying to write some actionscript

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.