title: Print all items in NSMutablearray
body: <p>My program has a tableview, I want to show selected items from the tableview in a textview</p>
  
  <p>I have following code <strong>which shows only the last item of the NSMutablearray</strong> in textview:</p>
  
  <p>I guess problem is the <strong>for loop</strong> but couldnt figure it out.</p>
  
  <p>stands is NSMutablearray, selectItems is NSMutablearray, selected items is UItexview.</p>
  
  <pre><code>- (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];
  }
  </code></pre>
  
  <p>I try the following but it crashes:</p>
  
  <pre><code>[selectItems addObject:[stands objectAtIndex:indexPath.row]];  
  int length = [selectItems count];
  
      for(int i=0;i&lt;=length;i++){
          selectedItems.text= [selectItems objectAtIndex:i];
      }
  </code></pre>
  
  <p>how can I show all  the items of NSmutablearray in a texview ?</p>