Hello
I am making a simple program which is taking input from user and saving it is an NSMutableArray, I am passing that NSMutableArray to another class which is subclass of UITableViewController by using a method. The NSMutableArray is correctly passed and I can see it by using NSLog. but I want to see the NSMutableArray in my table cells.
I am writing it as following code, but I think it is not relaoding the UITabBarController, so please see the code and help me out…
-(void) myMethodNew:(NSMutableArray*)allOrders {
sameallOrders = [[NSMutableArray alloc] init];
[sameallOrders addObject:allOrders];
NSLog(@"%@", sameallOrders);
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of rows in the section.
return [sameallOrders count];
}
- (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] autorelease];
}
NSString *cellValue = [sameallOrders objectAtIndex:indexPath.row];
cell.textLabel.text = cellValue;
return cell;
}
if you can’t understand anything which I have done, ask me, I will properly explain again, help me ….
I will praise definitely…
add
[myTableView reloadData];to the end of your myMethodNew (change myTableView to whatever your table view is named as)