Note that there are some explanatory texts on larger screens.

plurals
  1. POTableView cell for row at index path is not beeing called every time
    primarykey
    data
    text
    <p>I have created a class to generate tickets and when the ticket is generated I want to show it in the table view one by one. I have created a protocol for that class and once the ticket is prepared I send a message to its delegate which is <code>tableView</code> to reload the table view. when the <code>reload</code> method is called on the <code>tableView</code> <code>- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section</code> is being called every time a new ticket is generated but the <code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath</code> is not being called every time the ticket is generated but once all the tickets are generated it is being called</p> <p>below is the code</p> <pre><code>- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (self.ticketGenerator == nil) { return 0; } else{ return self.ticketGenerator.ticketNumbers.count; } } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; HSEticketView *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[HSEticketView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; [cell Tickets:[self.ticketGenerator.ticketNumbers objectAtIndex:indexPath.row]]; } // Configure the cell... return cell; } //to increase the height of the cell - (CGFloat)tableView:(UITableView *)aTableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 135; } -(void)background { [self.ticketGenerator GenerateNoOfTickets:[self.enteredNo.text intValue]:self]; } - (IBAction)done:(id)sender { [self.enteredNo resignFirstResponder]; self.enteredNo.hidden = YES; self.label.hidden = YES; self.button.hidden = YES; self.tableView.hidden = NO; [self performSelectorInBackground:@selector(background) withObject:nil]; NSLog(@"dgf"); } #pragma ticketGenrate delgate methods -(void)generationOfTicketCompleated { [self.tableView reloadData]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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