I'm just learning Swift and I'm having some trouble with adding a UITextField. This is currently what I have in my GameOverScene.swift file:
import SpriteKit
import UIKit
class GameOverScene: SKScene{
let gameOver = SKLabelNode(fontNamed: "I pixel u")
let submitScore = SKSpriteNode(imageNamed: "button")
let submitScoreText = SKLabelNode(fontNamed: "I pixel u")
let submitScoreTextShadow = SKLabelNode(fontNamed: "I pixel u")
let highScoreText = UITextField(frame: CGRectMake(self.frame.width/2, self.frame.height/2+20, 320, 40))
override func didMoveToView(view: SKView) {
self.backgroundColor = UIColor(hex: 0x80D9FF)
highScoreText.center = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame))
highScoreText.borderStyle = UITextBorderStyle.RoundedRect
highScoreText.textColor = UIColor(hex: 0x000000)
highScoreText.placeholder = "Enter your name here"
highScoreText.backgroundColor = UIColor(hex: 0xFFFFFF)
highScoreText.autocorrectionType = UITextAutocorrectionType.Yes
highScoreText.keyboardType = UIKeyboardType.Twitter
highScoreText.clearButtonMode = UITextFieldViewMode.WhileEditing
highScoreText.autocapitalizationType = UITextAutocapitalizationType.AllCharacters
self.view!.addSubview(highScoreText)
}
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
for touch: AnyObject in touches {
let location = touch.locationInNode(self)
if self.nodeAtPoint(location) == self.submitScoreText{
highScoreName = highScoreText.text
}
}
}
}
I'm getting "'GameOverScene -> () -> GameOverScene' does not have a member named 'frame'" on line 08 where the TextField is defined. Not quite sure what I'm doing wrong and I can't seem to figure out a fix for it. Any idea how I could handle this properly?