創建的UITextField我想實現一個文本框輸入你對我的SpriteKit遊戲的名字,所以我有這樣的事情:如何在SpriteKit
SKLabelNode* gameTitle = [SKLabelNode labelNodeWithFontNamed:@"Chalkduster"];
gameTitle.text = @"Game Title";
gameTitle.name = @"gametitle";
gameTitle.fontSize = 44.0;
gameTitle.fontColor = [SKColor blackColor];
gameTitle.position = CGPointMake(self.size.width/2,self.size.height/2 + 150);
[self addChild:gameTitle];
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(self.size.width/2, self.size.height/2+20, 200, 40)];
textField.borderStyle = UITextBorderStyleRoundedRect;
textField.textColor = [UIColor blackColor];
textField.font = [UIFont systemFontOfSize:17.0];
textField.placeholder = @"Enter your name here";
textField.backgroundColor = [SKColor whiteColor];
textField.autocorrectionType = UITextAutocorrectionTypeYes;
textField.keyboardType = UIKeyboardTypeDefault;
textField.clearButtonMode = UITextFieldViewModeWhileEditing;
textField.delegate = self.delegate;
[self.view addSubview:textField];
所以,問題是,它不顯示在我的現場,也許問題是將它添加到場景中時,我使用addSubview。
這是錯的嗎?
嘗試使用一個UITextView – LearnCocos2D
@ LearnCocos2D仍然是相同的,它不會出現:/ – Vergmort