---
title: "dispalying data from NSarray to table view"  
description: "dispalying data from NSarray to table view"  
author: "Anonymous User"  
published: 2015-08-12  
updated: 2015-08-12  
canonical: https://www.mindstick.com/forum/33412/dispalying-data-from-nsarray-to-table-view  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 1 minute  

---

# dispalying data from NSarray to table view

I am new in iOS and making a lightweight application. I am taking two textfield entries from [one view controller](https://www.mindstick.com/interview/22801/can-we-use-two-tableview-controllers-on-one-view-controller) and [storing them](https://www.mindstick.com/interview/34007/how-can-you-check-if-a-user-has-accepted-cookies-before-storing-them) in NSDictionary. I am transferring those [data](https://www.mindstick.com/articles/13050/salesforce-aiming-to-dominate-predictive-analytics-with-data-science) in NSArray. Now I want to display those data from NSArray to [table view](https://www.mindstick.com/forum/33654/send-table-view-cell-value-on-button-action-in-ios). I am using this line of code:

```
cell.textLabel.text = [self.myArray objectAtIndex:indexPath.row];
```

But my [app is crashing](https://answers.mindstick.com/qa/94760/how-do-i-find-out-why-an-app-is-crashing-android) when [cursor](https://www.mindstick.com/articles/13003/create-a-simple-cursor-in-sql-server) comes at this line. Help is appreciated. Thanks in advance.

## Replies

### Reply by Tarun Kumar

For UITableView you have to define at least 2 methods:

```
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:- (UITableViewCell *)tableView:(UITableView *)tableView  cellForRowAtIndexPath:                                                         (NSIndexPath *)indexPath
```

It seems your method numberOfRowsInSection is not implemented.

Try to add this:

```
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection: {
    return [self.myArray count];
}
```

Of course your ViewController have to be delegated for UITableViewDataSource and UItableViewDelegate.


---

Original Source: https://www.mindstick.com/forum/33412/dispalying-data-from-nsarray-to-table-view

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
