I'm having an issue with my UITableviewCell
, it generates only the first index inside of my NSMutableArray
. I've used NSLog(@"Count %i %@", [enterPrise_names count], enterPrise_names);
To check the number of objects inside of my NSMutableArray
everything seems fine with that.
I've already wired up everything including the UItableViewDataSource
, UITableViewDelege
, and Matching up the cell identifier of the TableViewCell.
The problem is that two of my labels only show the first object inside of my NSMutableArrays
.
I want to post the photos of my simulation to you guys but this is my first post of Stackoverflow and I don't have enough reputation to do that task.
well it looks like this
Fuji Siam
Fuji Siam
Fuji Siam
Fuji Siam
Fuji Siam
Fuji Siam
Here is my code
#import "MyQueueViewController.h"
#import "QueueCell.h"
@interface MyQueueViewController ()
@end
@implementation MyQueueViewController
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidAppear:(BOOL)animated
{
}
- (void)viewDidLoad
{
[super viewDidLoad];
enterPrise_names = [[NSMutableArray alloc]initWithObjects:@"Fuji",@"MK",@"KFC",@"PizzaHut",@"McDonal",@"BurgerKing", nil];
BranchName = [[NSMutableArray alloc]initWithObjects:@"Siam",@"Paragon", @"CTW", @"Pinklao", @"Bangkae", @"Bangna", nil];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return [enterPrise_names count];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyIdentifier = @"QueueCell";
QueueCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil) {
cell = [[QueueCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier];
}
NSLog(@"Count %i %@", [enterPrise_names count], enterPrise_names);
cell.txtBranch.text = [BranchName objectAtIndex:indexPath.row];
cell.txtShop.text = [enterPrise_names objectAtIndex:indexPath.row];
return cell;
}
I would be very appreciated if any of you guys would point out my mistakes. Thank you very much for your help.