开发者

iphone reload tableView

In the following code, I have determined that everything works, up until [tableView reloadData] i have NSLOGs set up in the table view delegate methods and none of them are getting called. I have other methods doing the same reloadData and it works perfectly. The only difference tha I am awayre of is tha this is in a @catch block. maybe you smart guys can see something i'm doing wrong...

@catch (NSException * e) {////chart is user genrated
    logoView.image = nil;
    NSInteger row = [picker selectedRowInComponent:0];
    NSString *selectedAircraft = [aircraft objectAtIndex:row];
    NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
                                                         NSUserDomainMask, YES);
    NSString *docsPath = [paths objectAtIndex:0];
    NSString *checklistPath = [[NSString alloc]initWithFormat:@"%@/%@.checklist",docsPath,selectedAircraft];
    NSString *dataString = [NSString stringWithContentsOfFile:checklistPath encoding: NSUTF8StringEncoding error:NULL];


    if ([dataString hasPrefix:@"\n"]) {
        dataString = [dataString substringFromIndex:1];
    }
    NSArray *tempArray = [dataString componentsSeparatedByString:@"\n"];

    NSDictionary *temporaryDictionary = [NSDictionary dictionaryWithObject: tempArray forKey:@"User Generated Checklist"];
    self.names = temporaryDictionary;


    NSArray *tempArray2 = [NSArray arrayWithObject:@"01User Generated Checklist"];
    self.keys = tempArray2;
    aircraftLabel.text = selectedAircraft;
    checklistSelectPanel.hidden = YES;
    [tableView rel开发者_如何学PythonoadData];


}


You probably don't want to hear this but you didn't specifically mention it so it has to be asked - have you actually set the tableView delegate?


I ran into this same problem. After tearing my hair out for days on end, I realized that I had set my table as the view (ie my view controller's view property was set to the table), and apparently, that is a no-no.

If your table is your view, make another view, and place the table inside the new view you created. Et voila, your table refreshes.


"User Generated Checklist" and "01User Generated Checklist"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜