What is code for upload the NSMutableArray data to TableView?

2 Solutions Collect From Internet About “What is code for upload the NSMutableArray data to TableView?”

AS you told you have collected the data in your Array(NSMutableArray).
You can show these data in TableView For this you have to follow below Steps

1)Create Instance of UItableView in .h class

AS UITableView *myTableView;

2) Adopt The UITableViewDataSource,UITableViewDelegate protocol in ViewController Where you going to show TableView

3)Create Table (programmatically or by IB(Interface Builder)
here i am showing Programmatically

//you may call this Method View Loading Time.    
-(void)createTable{
 myTableView=[[[UITableView alloc]initWithFrame:CGRectMake(0, 0,320,330)    style:UITableViewStylePlain] autorelease];
 myTableView.backgroundColor=[UIColor clearColor];
myTableView.delegate=self;
myTableView.dataSource=self;
myTableView.separatorStyle=  UITableViewCellSeparatorStyleNone;
myTableView.scrollEnabled=YES;
[self.view addSubview:myTableView];

}

Data Source method to create number of section in Table View


- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 
return 1;   
}

Data Source method to create number of rows section of a Table View

- (NSInteger)tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section {
return [yourMutableArray count];
}

Data Source method to create cells in Table View

 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 

static NSString *CellIdentifier = @"Cell";
//here you check for PreCreated cell.
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}

//Fill the cells...  
    cell.textLabel.text = [yourMutableArray objectAtIndex: indexPath.row];
//yourMutableArray is Array 
return cell;
}

I Hope It’ll really Help You .

Basically you have to make a UITableView (you can find a tutorial online), and then to load the NSMutableArray into it, use the following code in the method

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }

    // Configure the cell...
        cell.textLabel.text = [theArray objectAtIndex: indexPath.row];

    return cell;