I am writing a splash screen. The splash screen would connect to the server and receive some data. When the data has been received successfully, I want to programmatically go to the next viewcontrller. How can I achieve this? Its not the same as button click? Because I dont get forwarded to my next screen even when I put the code in my viewDidLoad of my LoadingViewContrller.
TableViewController *tvc = [[TableViewController alloc] init];
tvc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:tvc animated:NO];
I would like to jump to TableViewContrller automatically after all my data has been retrieved.
Below are my codes when I am retrieving data from the network.
- (void)fetchedData:(NSData *)responseData {
if(responseData == nil){
[ErrorViewController showError];
}else{
//methods to start parsing and adding json into array
if(delegate){
[delegate jsonReceivedData:array];
//codes to go to next screen should be here
}
}
Okay, the way to do this is simple. Make the first screen for your app the same as the splash screen. Declare and instantiate an NSTimer, possibly in viewWillAppear, like so:
Then instantiate a BOOL:
In the method accessed by your timer (in this case “updateTime”) do the following:
For the sake of space, I’m leaving out the declarations of
mainTimerandmyBool.