我在两个视图控制器之间切换,但在第二个视图运行之前有1或2秒的延迟。如何更有效地实现这一点,以便在应用程序启动时加载所有内容?
这是我的代码:
我有一个按钮进行切换:
- (IBAction)soundListButton:(id)sender {
BBRViewController * controller = [[BBRViewController alloc]
initWithNibName:@"BBRViewController" bundle:nil];
controller.modalTransitionStyle=UIModalTransitionStyleCoverVertical;
[self presentViewController:controller animated:YES completion:nil];
}
我在第二个视图上的viewDidLoad:
- (void)viewDidLoad {
[super viewDidLoad];
NSURL *buttonURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"applause_y" ofType:@"wav"]];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)buttonURL,
&SoundID);
NSArray *array = [[NSArray alloc] initWithObjects:@"applause_y", @"applause_y", nil];
self.listData = array;
}