在XIB中它对我来说很好。
ThirdViewController *thirdVC = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil];
// preload views to the memory
[thirdVC view];
// setup fromviews array and toviews array
NSArray *fromViews = [NSArray arrayWithObjects:self.imageView1, self.imageView2, self.label1, nil];
NSArray *toViews = [NSArray arrayWithObjects:thirdVC.imageView1, thirdVC.imageView2, thirdVC.label1, nil];
[self pushViewController:thirdVC fromViews:fromViews toViews:toViews duration:1.0];
但是当我在故事板中将视图预加载到内存中时,我不知道如何使用它。
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"FourthVC" bundle:nil];
FourthVC *vc = [sb instantiateViewControllerWithIdentifier:@"FourthVC"];
NSArray *fromViews = [NSArray arrayWithObjects:self.imageView1, self.imageView2, self.label1, nil];
NSArray *toViews = [NSArray arrayWithObjects:vc.imageView1, vc.imageView2, vc.label1, nil];
[self pushViewController:vc fromViews:fromViews toViews:toViews duration:1.0];
任何人都可以建议我如何在故事板中预加载视图?
答案 0 :(得分:0)
我得到了答案感谢@ Tj3n
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"FourthVC" bundle:nil];
FourthVC *vc = [sb instantiateViewControllerWithIdentifier:@"FourthVC"];
// preload views to the memory
[vc view];
NSArray *fromViews = [NSArray arrayWithObjects:self.imageView1, self.imageView2, self.label1, nil];
NSArray *toViews = [NSArray arrayWithObjects:vc.imageView1, vc.imageView2, vc.label1, nil];
[self pushViewController:vc fromViews:fromViews toViews:toViews duration:1.0];