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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:38:20+00:00 2026-06-01T16:38:20+00:00

My program has a tableview, I want to show selected items from the tableview

  • 0

My program has a tableview, I want to show selected items from the tableview in a textview

I have following code which shows only the last item of the NSMutablearray in textview:

I guess problem is the for loop but couldnt figure it out.

stands is NSMutablearray, selectItems is NSMutablearray, selected items is UItexview.

- (void) tableView: (UITableView *) tableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath {
    [selectItems addObject:[stands objectAtIndex:indexPath.row]];    
    for (NSString *yourVar in selectItems) {

        selectedItems.text=yourVar;
        NSLog (@"Your Array elements are = %@", yourVar);

    }

    [self.mytableView reloadData];
}

I try the following but it crashes:

[selectItems addObject:[stands objectAtIndex:indexPath.row]];  
int length = [selectItems count];

    for(int i=0;i<=length;i++){
        selectedItems.text= [selectItems objectAtIndex:i];
    }

how can I show all the items of NSmutablearray in a texview ?

  • 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-01T16:38:22+00:00Added an answer on June 1, 2026 at 4:38 pm
    - (void) tableView: (UITableView *) tableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath {
        [selectItems addObject:[stands objectAtIndex:indexPath.row]];    
        NSMutableString *exString = [[NSMutableString alloc]init];
        for (NSString *yourVar in selectItems) {
    
            NSLog (@"Your Array elements are = %@", yourVar);
            [exString appendFormat:@"\n%@",yourVar];
    
        }
        selectedItems.text=exString;
    
        [self.mytableView reloadData];
    }
    

    What about something like this? It takes each object, puts a newline in it, then adds it to exString to form one long chain of the objects in your array.

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

Sidebar

Related Questions

My program has code that saves attachments, I want these attachments to be transferred
My relatively large program has a PDF help file which I have put together.
My program has a function that read/write file from resource. This function I have
My program has two forms which get data from the same data source. After
I am trying to create a program that has one tableview and when you
My program has one dialog and two sockets. Both sockets are derived from CAsyncSocket,
My program has the following class definition: public sealed class Subscriber { private subscription;
The target language is C/C++ and the program has only to work on Linux,
My program has two targets and I want to correctly configure this screen: I
My program has a grid of cells and I want to be able to

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.