0
我想實現SLParallaxController作爲主ViewController到我現有的項目,它有一個故事板。但是,隨着SLParallaxController,內容是動態創建的:SLParallaxController實施到故事板項目
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
self.window.clipsToBounds =YES;
self.window.frame = CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);
self.window.bounds = CGRectMake(0, 20, self.window.frame.size.width, self.window.frame.size.height);
}
self.window.rootViewController = [SLParallaxController new];
return YES;
}
由於didFinishLaunchingWithOptions不應該在所有的故事板基於項目中使用,我想實現這個正確的方法。
我已經試過的loadView,但返回黑屏:
-(void)loadView
{
UIWindow* window = [[UIApplication sharedApplication] keyWindow];
window.rootViewController = [SLParallaxController new];
}
有任何替代來實現SLParallaxController除了重建的故事板中的對象?
謝謝!