我有从 .nib 文件加载的 ViewController。在 viewDidLoad 方法中,我创建了一个子视图并将其添加到视图层次结构中。如何淡出该子视图以在 .nib 文件中显示视图?
(子视图就像一个启动屏幕,我想淡出以在 .nib 中显示视图,它是这样设置的,因为它对我来说是最简单的方式。)
这是我的一些代码(我试图从 viewDidLoad 的笔尖设置对原始视图的引用,但无法使其工作):
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
NSLog(@"View did load");
//set reference to view in .nib here
UIView *currentView = self.view;
CGRect frame = [[UIScreen mainScreen] bounds];
splashView = [[splashView alloc] initWithFrame:frame];
[[self view] addSubview:splashView];
//transition did not work
[UIView transitionFromView:splashView toView:currentView duration:0.25 options:UIViewAnimationOptionTransitionCrossDissolve completion:^(BOOL finished) {
NSLog(@"transition finished");
}];
}
该代码崩溃。我究竟做错了什么?