用于self.view addSubview的self.window.rootViewController的等效项

时间:2013-11-04 16:45:23

标签: ios objective-c

我想在我的应用中使用此控件

https://github.com/pyro2927/GKLParallaxPictures

我的应用正在使用Storyboards。在View的viewDidLoad中我希望使用GLKParallaxPictures有以下代码:

UIImage *testImage = [UIImage imageNamed:@"300-g.jpg"];
NSArray *photosArray1 = @[testImage, testImage, testImage];

GKLParallaxPicturesViewController *paralaxViewController = [[GKLParallaxPicturesViewController alloc] initWithImages:photosArray1                                                                                                   andContentWebView:webView];

[self.view addSubview:paralaxViewController.view];

上面代码的最后一行引发异常。

在控件的原始示例中,作者在AppDelegate中具有以下代码

UIImage *testImage = [UIImage imageNamed:@"shovel"];
NSArray *images = @[testImage, testImage, testImage];

GKLParallaxPicturesViewController *paralaxViewController = [[GKLParallaxPicturesViewController alloc] initWithImages:images
                                                                                                      andContentWebView:testWebView];
self.viewController = paralaxViewController;

self.window.rootViewController = paralaxViewController;
[self.window makeKeyAndVisible];
return YES;

0 个答案:

没有答案