I was wondering if it is at all possible to use NSString variables with UITextView in Xcode 5.
My experimentations have so-far proved unsuccessful and i was wondering if this sort of thing is even possible...
My goal is to have a variable with a word stored in it (like 'sad') and have that variable be part of a sentence in my UITextView (i.e. I am feeling [insert variable here].) making the sentence read 'I am feeling sad'.
Then if the variable changes the sentence will change. So if the variable's word is 'happy' the sentence will now be 'I am feeling happy'.
Is this possible?
I have tried figuring it out on my own but all of my attempts seem to end up in an error.
You can use the built-in string concatenation method in NSString to achieve this:
NSString *myString = @"sad";
textView.text = [NSString stringWithFormat:@"I am feeling %@.", myString];
// textView.text is now 'I am feeling sad.'