這裏有些時髦的東西不僅僅是展示插頁式廣告。我有一個精靈套件的項目設置,我從RootViewController的通過顯示的UIImagePickerController:回調過程中
#pragma mark - ImageCatureDelegate methods
-(void)requestImagePicker
{
UIImagePickerController *imagePicker = [UIImagePickerController new];
imagePicker.delegate = self;
[self presentViewController:imagePicker animated:YES completion:nil];
}
#pragma mark - UIImagePickerControllerDelegate
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
[picker dismissViewControllerAnimated:YES completion:^{
SKTexture *imageTexture = [SKTexture textureWithImage:image];
CIFilter *sepia = [CIFilter filterWithName:@"CISepiaTone"];
[sepia setValue:@(0.8) forKey:kCIInputIntensityKey];
imageTexture = [imageTexture textureByApplyingCIFilter:sepia];
SKView *view = (SKView *)self.view;
MyScene *currentScene = (MyScene *)view.scene;
[currentScene setPhotoTexture:imageTexture];
}];
}
,沒有什麼特別的是,除了駁回模式來完成。如果admob推送一個新的VC,你可能會看到這個問題,但是如果它以模態方式顯示文字模態VC ......那麼你不應該看到這個問題。您可能要仔細研究推送插頁式廣告時會發生的情況。如果是這種情況,並且這是唯一可以使用的方法,那麼您必須使用NSCode或其他內容才能保持遊戲狀態,以便在插頁式廣告消失時加載它。
編輯:
要追加到您的解決方案上面,如果你使用viewWillLayoutSubviews糾正SpriteKit利用縱向/橫向的問題,一定要做到這樣所以這只是發生「一次」
- (void)viewWillLayoutSubviews
{
[super viewWillLayoutSubviews];
// Configure the view.
SKView * skView = (SKView *)self.view;
if (!skView.scene) {
skView.showsFPS = YES;
skView.showsNodeCount = YES;
// Create and configure the scene.
MyScene * scene = [[MyScene alloc] initWithSize:skView.bounds.size andLevelNumber:1];
scene.scaleMode = SKSceneScaleModeAspectFill;
// Present the scene.
[skView presentScene:scene];
}
}
你能幫我嗎。您如何解決問題,我沒有得到您的答案 – seenu
viewWillLayout當插頁式廣告被解僱時調用子視圖。由於我在這種方法中創建了場景,因此它被重新創建。 – giorashc