Как установить точное время для заставки с загрузкой при запуске в запросе iPhone? - PullRequest
0 голосов
/ 31 января 2012

В моем приложении Map я вызвал метод веб-службы в методе ViewDidLoad.Поэтому мой экран-заставка отображается дольше (более 5 секунд), если сеть плохая для загрузки данных веб-службы на моем первом экране MapView.

Я хочу показать Default.png всего за 3 секунды, а затем мой первый экран с индикатором загрузки, как недавнее приложение facebook на iPHone.Какая логика стоит за приложением.Я перепробовал много вещей, но безуспешно.Заранее спасибо.

Ответы [ 3 ]

0 голосов
/ 31 января 2012

Во-первых, вы должны поместить default.png, а затем

. Добавьте простой viewcontroller, как показано ниже:

[window addSubview:viewController.view];

В него можно добавить индикатор Activitiy для вставки.

, а затем, когда соединение с Интернетом завершится, следует следующий метод делегата для вызова

-(void)ShowTabAbout{
    [viewController.view removeFromSuperview];  
    self.imgV.frame=CGRectMake(0, 425, 320, 55);
    self.imgV.image=[UIImage imageNamed:@"tBar5.png"];
    [self.tabctr.view addSubview:self.imgV];
    self.tabctr.selectedIndex=4;
    [self animationTabCode];
    [window addSubview:tabctr.view];
}

Ниже приведен код для анимации

-(void)animationTabCode{
    CGContextRef context = UIGraphicsGetCurrentContext();
    [UIView beginAnimations:nil context:context];
    [UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:self.window cache:YES];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [UIView setAnimationDuration:0.5];
    [UIView commitAnimations];
}

Этот тип вы можете создатьприложение, как мудрый

0 голосов
/ 31 января 2012
You will need to use performSelector: withDelay: method and provide the delay to 3-4 seconds, whatever is desired. NSTimer will also work but perfomSelector is a more lighter approach.

Try using it in the function where you allocate the splash image. In this case as u said u need to call from ViewDidLoad another function something like performSelector:removeSplashScreen and put this in [self performSelector:removeSplashScreen afterDelay:4 withObject:imgSplash];

THis will call the removeSplashScreen after 4 seconds and hence pass the splash image as parameter to this function.
 Inside removeSplashScreen do something like this:
-(void)removeSplashScreen:(UIImageView*)imgSplash {

//remove splash hence 4 seconds have passed.
[imgSplash removeFromSupreview];
[imgSplash release];

//After this allocate UIActivityIndicator view or whatever custom view for further loading
//You can also call an NSURLConnection here for the data parsing as the splash has been //removed thereby showing an activity to user.

}

//hope this helps :)
}
0 голосов
/ 31 января 2012

Используйте NSTimer для этой функции.

...