連投になってしまって申し訳御座いません。前回の質問がまだ解決していないのにベストアンサーをつけてしまい解決済みになってしまいました。本格的に使うのは初めてでして何分ご容赦を。
xcodeのシミュレータが、起動はするのですが自分なりに正しいコードは書いているつもりなのですが何も表示されません。色んなコードを試してみて原因究明をはかったのですがどのコードも動かずじまいです。今動かしたいコードは以下の通りです。
//GameScene.swift
'''lang-swift
import SpriteKit
class GameScene: SKScene {
var HomeBackGround = SKSpriteNode()
override func didMove(to view: SKView) {
HomeBackGround = SKSpriteNode(imageNamed: "HomeBackGround")
HomeBackGround.position = CGPoint(x: self.frame.width/2, y: self.frame.height/2)
self.addChild(HomeBackGround)
}
}'''
//AppDelegate.swift
'''import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
return true
}
func applicationWillResignActive(_ application: UIApplication) {
}
func applicationDidEnterBackground(_ application: UIApplication) {
}
func applicationWillEnterForeground(_ application: UIApplication) {
}
func applicationDidBecomeActive(_ application: UIApplication) {
}
func applicationWillTerminate(_ application: UIApplication) {
}
}'''
//GameViewController
'''import UIKit
import SpriteKit
import GameplayKit
class GameViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
override var shouldAutorotate: Bool {
return true
}
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
if UIDevice.current.userInterfaceIdiom == .phone {
return .allButUpsideDown
} else {
return .all
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
override var prefersStatusBarHidden: Bool {
return true
}
}'''
回答1件
あなたの回答
tips
プレビュー