How can i automatically push my view controller to another view controller? I got this code in viewWillApear, when my Tabledata contains 1 item it need to push it directly to another view controller but it doesn’t work
if ([DatainTable count] == 1) {
count.text = [NSString stringWithFormat:@"xxx"];
xViewController *scoreView = [[xViewController alloc]initWithNibName:@"xViewController" bundle:nil];
[scoreView.count setText:count.text];
[self.navigationController pushViewController:scoreView animated:YES];
}
i tried alot of other things but without success
Instead of putting the code in
viewWillAppear:(where the actual pushing of the first view has not yet occurred), you should put it inviewDidAppear:(which is run when the first view has finished pushing and you can do any further tasks such as pushing a further controller)