2016-08-12 3 views
1

프로젝트 작업 중이며 SKNode는 장치 크기에 따라 동적으로 크기가 조정되지 않습니다.SpriteKit은 이미지가 화면에 딱 맞지 않고 늘려지지 않습니다.

예 :

Image one enter image description here

내가 두 번째로 발생하는 첫 번째 이미지에 무슨 싶습니다. 이 작업을 자동으로 수행 할 수있는 방법이 있습니까? 표시된 이미지

현재 크기 :

background.position = CGPoint(x: frame.size.width/2, y: frame.size.height/2) 
    background.size = CGSize(width: background.size.width/5.5, height: background.size.height/5.5) 

GameViewController :

import UIKit 
import SpriteKit 

class GameViewController: UIViewController { 

override func viewDidLoad() { 
    super.viewDidLoad() 

    // Configure the view. 
    let skView = self.view as! SKView 
    skView.showsFPS = false 
    skView.showsNodeCount = false 

    let scene = GameScene(size: skView.bounds.size) 

    scene.controller = self 
    scene.size = skView.bounds.size 

    /* Sprite Kit applies additional optimizations to improve rendering performance */ 
    skView.ignoresSiblingOrder = true 

    /* Set the scale mode to scale to fit the window */ 
    scene.scaleMode = .AspectFill 

    skView.presentScene(scene) 
} 

override func shouldAutorotate() -> Bool { 
    return true 
} 

override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask { 
    if UIDevice.currentDevice().userInterfaceIdiom == .Phone { 
     return .AllButUpsideDown 
    } else { 
     return .All 
    } 
} 

override func didReceiveMemoryWarning() { 
    super.didReceiveMemoryWarning() 
    // Release any cached data, images, etc that aren't in use. 
} 

override func prefersStatusBarHidden() -> Bool { 
    return true 
} 
} 

답변

0

당신은 게임이 방금 열 필요가 더 큰 화면 장치에 표시 될 때 전체 화면 크기를 조정하려면 GameViewController.swift 및 사용 중인지 확인하십시오. AspectFill

scene.scaleMode = .AspectFill 
+0

내 GameViewController ..에이 코드 줄이 이미 있습니다. 이상한. 어쩌면 무시당하는 것일까 요? @appzYourLife –