我有從.nib文件加載的ViewController。在viewDidLoad方法中,我創建了一個子視圖並將其添加到視圖層次結構中。如何淡出該子視圖以在.nib文件中顯示視圖?如何淡出子視圖以顯示從.nib加載的UIViewController視圖
(子視圖就像一個閃屏,我想淡出,以顯示在筆尖的看法,它的成立這種方式,因爲對我來說是最簡單的方法。)
下面是一些我的代碼(我試圖設置爲從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");
}];
}
該代碼崩潰。我究竟做錯了什麼?
你看過使用storyboard/segues嗎? –