mainAppのviewDidLoadで開始されるログインがあります。これは、mainAppのnumberOfRowsInSectionがログインの前に実行され、テーブルビューが作成されないことを意味します。
私はJsonArrayをmainAppのviewWillAppearに持っており、ログイン後にnumberOfRowsInSectionも実行するreloadData関数を持っています。だから私は入れます:
[self.tableView reloadData];
...ビューに表示されます。しかし、これはログイン後に実行されません。
助言がありますか?
前もって感謝します。
コードの更新
ログインページ
if (serverOutput != nil) {
//UIAlertView *alertSuccess = [[UIAlertView alloc] initWithTitle:@"Congrats" message:@"You are authorised" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
//[alertSuccess show];
//[alertSuccess release];
LucentaAppDelegate *appDelegate = (LucentaAppDelegate *)[[UIApplication sharedApplication] delegate];
appDelegate.userProducts = serverOutput;
loginButton.enabled = FALSE;
[self dismissModalViewControllerAnimated:YES];
メインビュー
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
LucentaAppDelegate *appDelegate = (LucentaAppDelegate *)[[UIApplication sharedApplication] delegate];
self.jsonArray = [appDelegate.userProducts JSONValue];
//[self.tableView reloadData];
[self performSelector:(@selector(refreshDisplay:)) withObject:(tableView) afterDelay:0.5];
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Test Alert" message:@"View Will Appear." delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles: nil];
[alert show];
[alert release]; }
-(void)refreshDisplay:(UITableView *)tableView {
[self.tableView reloadData];}