Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It seems like your tableview is load et call its delegates methods before your NSURLConnection finished downloading. You have launch NSURLConnection by</p> <pre><code>NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; </code></pre> <p>so the connection is asynchronous. You can't be sure whether it finishes before or after your tableview loads its view. But your can always do a check in your tableview methods to make your app work. For example:</p> <pre><code>- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { int nbCount = [items_subject count]; if (nbCount == 0) return 1; else return [items_subject count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { int nbCount = [items_subject count]; static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]; } // Configure the cell... if (nbCount ==0) cell.textLabel.text == @"Loading"; else { // your configuration cell.textLabel.text = [NSString stringWithFormat:@"%@" ,[items_subject objectAtIndex:indexPath.row]]; } return cell; } </code></pre> <p>In your method "ConnectionDidFinishLoading", then your can call [tableview reloaddata] to update your tableview.</p> <p>[EDIT] on 12/09/2012</p> <p>I've got your code work(not a nice solution), you should rethink how you organize your viewControllers.</p> <ol> <li><p>add the IBOutlet TableView to myloxfileController.tableView. add this line <code>myloxfileContoller.tableView = myloxfileTable;</code> after the line <code>myloxfileContoller.view = myloxfileContoller.tableView;</code> in <code>- (void)viewDidLoad</code> of the interface <code>ViewController</code> .</p></li> <li><p>reload tableview data when connection finished. add this line <code>[self.tableView reloadData];</code> after the line <code>items_subject = subject_data_Array;</code> in <code>-(void)connectionDidFinishLoading:(NSURLConnection *)connection</code> of the interface <code>MyLoxFileTVController</code> .</p></li> </ol> <p>This will work because when the download finished, you reloadData of the IBOutlet TableView. </p>
    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