Note that there are some explanatory texts on larger screens.

plurals
  1. POTableview doesn't fire cellForRowtIndexPath method
    text
    copied!<p><strong>My situation:</strong></p> <ul> <li>I've got <code>datasource</code> and <code>delegate</code> connect in the storyboard</li> <li>I've got for my <code>UITableViewCell</code> and identifier and also in code defined, etc.</li> <li>I've got the <code>array</code> with data for my <code>UITableView</code>, in debug my data <code>array</code> is filled in <code>viewDidload</code> method</li> </ul> <p>So everything seems right till I arrive to <code>cellForRowIndexPath</code> and <code>numberOfRowsInSection</code>. It doesn't go into the methods. When I run further, debug is complete, don't get any faults, only a black <code>UITableView</code> i get with nothing in. Really strange cus my array is filled with data and everything is connected as it should be.</p> <p>Some help is needed, i'm searching for days now!</p> <p>If code is needed to help, ask me.</p> <p><strong>My code:</strong></p> <p><em><strong>m.file:</em></strong></p> <pre><code>#import "DagprogrammaDetailViewController.h" @interface DagprogrammaDetailViewController () @end @implementation DagprogrammaDetailViewController { NSMutableArray *DagprogrammaDetail; } @synthesize menuNaam; @synthesize tableDagprogrammaDetail; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.title = menuNaam; NSArray *dagarray = [menuNaam componentsSeparatedByString:@" "]; NSString *plaatsString = [dagarray objectAtIndex:1]; plaatsString = [plaatsString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; //object ophalen NSMutableString *urlString = [NSMutableString stringWithFormat:@"http://zesdaagse.mobi-app.be/WCFUrl/MobileService.svc/GetDagprogramma"]; NSURL *url = [NSURL URLWithString:urlString]; NSData *data = [NSData dataWithContentsOfURL:url]; NSError *error; NSMutableDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&amp;error]; NSMutableArray *id = [NSMutableArray array]; for(NSDictionary *item in json) { [id addObject:[item objectForKey:@"id"]]; } int plaats = [plaatsString intValue]; plaats -= 1; //id van de dag ophalen NSString *idDagprogramma = [id objectAtIndex:plaats]; urlString = [NSMutableString stringWithFormat:@"http://zesdaagse.mobi-app.be/WCFUrl/MobileService.svc/GetDagprogrammaWedstrijden?id="]; [urlString appendString:[NSString stringWithFormat:@"%@",idDagprogramma]]; url = [NSURL URLWithString:urlString]; data = [NSData dataWithContentsOfURL:url]; json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&amp;error]; NSMutableArray *idWedstrijdDagprogramma = [NSMutableArray array]; NSMutableArray *naam = [NSMutableArray array]; NSMutableArray *uur = [NSMutableArray array]; for(NSDictionary *item in json) { [idWedstrijdDagprogramma addObject:[item objectForKey:@"id"]]; [naam addObject:[item objectForKey:@"naam"]]; [uur addObject:[item objectForKey:@"uur"]]; } DagprogrammaDetail = [NSMutableArray arrayWithObjects: nil]; for(int i = 0; i &lt; json.count; i ++) { NSMutableString *lijn =[NSMutableString stringWithFormat:@"%@", [naam objectAtIndex:i]]; [lijn appendString:[NSMutableString stringWithFormat:@"%s", "\t \t"]]; [lijn appendString:[NSMutableString stringWithFormat:@"%@", [uur objectAtIndex:i]]]; [DagprogrammaDetail addObject:lijn]; } } //methode om aantal items te weten van de array - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [DagprogrammaDetail count]; } //methode om een item aan een index te koppelen en zichtbaar te maken - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *simpleTableIdentifier = @"MenuDetailCell"; UITableViewCell *cell = [self.tableDagprogrammaDetail dequeueReusableCellWithIdentifier:simpleTableIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier]; } cell.textLabel.numberOfLines = 1; cell.textLabel.text = [DagprogrammaDetail objectAtIndex:indexPath.row]; return cell; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload