Xcode: How do I get a textLabel to display addition static text that is being entered in the textField?

后端 未结 1 1252
情书的邮戳
情书的邮戳 2021-01-29 09:56

I am a Xcode newbie, please help.

So I know how to change the text in Label box by with a text field:

self.textLabel.text = self.textField.text

The quest

相关标签:
1条回答
  • 2021-01-29 10:28

    You need to concatenate 2 Strings. Here are some clues:

    Shortcuts in Objective-C to concatenate NSStrings

    Concatenate String in String Objective-c

    Simple string concatenation in Objective C

    So:

    self.textLabel.text = [@"Hi" stringByAppendingString: self.textField.text]
    

    or

    [textLabel setStringValue: [@"Hi" stringByAppendingString: self.textField.text]];
    
    0 讨论(0)
提交回复
热议问题