여러 개의 viewController가있는 앱을 개발 중입니다. 첫 번째 것은 "MainMenu"이고 두 번째 것은 "Page1"입니다.Objective-c : 다음 페이지로 이동하면 "기다려주십시오"라는 메시지가 표시됩니다.
다음 페이지로 이동할 때 "기다려주십시오 ..."라는 경고가 표시됩니다. 아래 코드가 작동하지만 "page1"로드 된 후 경고가 나타납니다. 사용자가 "MainMenu"페이지에서 버튼을 누르면 나타납니다.
이 작업을 수행하기위한 제안이 있으십니까? 사전에
감사합니다.
AppDelegate.m
-(void)showAlert{
altpleasewait = [[UIAlertView alloc] initWithTitle:@"Please Wait..." message:nil delegate:self cancelButtonTitle:nil otherButtonTitles: nil];
[altpleasewait show];
UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
indicator.center = CGPointMake(altpleasewait.bounds.size.width/2, altpleasewait.bounds.size.height - 50);
[indicator startAnimating];
[altpleasewait addSubview:indicator];
}
-(void)waitASecond{
[self performSelector:@selector(dismissAlert) withObject:self afterDelay:0.8];
}
-(void)dismissAlert{
[altpleasewait dismissWithClickedButtonIndex:0 animated:YES];
}
MainMenu.m
-(void)gotoNextPage{
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate];
[appDelegate showAlert];
page1 = [self.storyboard instantiateViewControllerWithIdentifier:@"Page1"];
[self presentModalViewController:page1 animated:NO];
}
Page1.m IBAction를에 경고를 넣어 당신이 할 수
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate];
-------------some methods--------------
[appDelegate waitASecond];
당신은 MBProgressHUD을 시도해야합니다 : https://github.com/jdg/MBProgressHUD –
내가 두 번째 것을, 완벽하게 작동 – basvk
와우 좋은 하나입니다. 나는 나중에 이것을 시도 할 것이다. – user973067