开发者

Objective - C Custom Table View Problems

I have this code:

 - (void)viewDidLoad {
    [super viewDidLoad];
    NSLog(@"ViewDidLoad");

    username = @"itemstiubhart1";
    titleEle = @"titlestiubhart1";
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    NSLog(@"ViewWillAppear");
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];

    if ([stories count] == 0) {
        NSString * path = @"http://myurl.com/events.php";
        [self parseXMLFileAtURL:path];
    }
    NSLog(@"viewDidAppear");
}

- (void)viewWillDisappear:(BOOL)animated {
}

- (void)viewDidDisappear:(BOOL)animated {
}

You may need more of my code than this, however I'm sure I'm missing something fairly fundament开发者_StackOverflow社区al. Basically my problem is this, the viewDidLoad method executes fine, however the next method that should run (viewWillAppear) simply doesn't run at all...And a blank table view appears. Am I missing something fundamental? Or is my problem likely a bit more complex? Just seems a bit strange. I have the same code in another project, but that project uses a navigation controller and this one uses a view controller, I think it has something to do with that as the other project works fine.

Thanks,

Jack


I guess that you are adding the view manually as a subview through [view addSubview:subview].

In this case, you have to call -viewWillAppear: yourself.

Check also this question and Apple Docs (a custom view controller has to implement viewWillAppear).


You have to reload table again when parsing is complete. Table view may coming blank because of empty data values

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜