dispalying data from NSarray to table view

Total Post:20


 1294  View(s)
Rate this:

I am new in iOS and making a lightweight application. I am taking two textfield entries from one view controller and storing them in NSDictionary. I am transferring those data in NSArray. Now I want to display those data from NSArray to table view. I am using this line of code:

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

But my app is crashing when cursor comes at this line. Help is appreciated. Thanks in advance.


  1. Re: dispalying data from NSarray to table view

    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.

      Modified On Apr-10-2018 02:10:14 AM


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.