Shorten A Bit Of Text In A UITextView and Make It Pop Up In A UIAlertView
Okay say you have a UITextField and a UITextView. Now when you type into the UITextField and then you click Done on the keyboard so it goes away and then whatever you typed into the UITextField it will pop up in the UITextView. I got that all working. But lets say you typed "I will be right back" and then you click Convert on the top button corner. Then it will convert and it will pop up in a UIAlertView with your new message. So in the UIAlertView it should say it converted it to "I will brb" how can I make it convert just some bits of text in code? I don't want it to convert it to a whole new thing just a bit. So like from I will be right back to I will brb. How can I do that? I really need this asap. Also I am not referring to this code.
if(textView.text isEqualToString:@"I will Be right back") {
textView.text = @"BRB"
}
I am not referring to that code above. That will replace the whole text. I want it to just change a bit of text and still have the other text there.
if ([textView.text rangeOfString:@"I will be right back"].location != NSNotFound){ //Check if textView has the string in it
textView.text = [textView.text stringByReplacingOccurrencesOfString:@"I will be right back" withString:@"BRB"]; //If it does, replace it.
}
if ([textView.text rangeOfString:@"I will be right back"].location != NSNotFound){ //Check if textView has the string in it
textView.text = [textView.text stringByReplacingOccurrencesOfString:@"I will be right back" withString:@"BRB"]; //If it does, replace it.
}
Tom
Actually nevermind! I got it! Thank you so much bro. You are freaking awesome!
Yeah that's right, it will just replace "be right back".
On second thought, you don't even need to check for it. If it's there it will be replaced, if it's not, it won't. Simple.
I don't fully understand the second bit...
You just want to put "BRB" into a UIAlertView?
Also, try using the [ CODE ] tags (no spaces), it makes your code a lot easier to read
Yeah that's right, it will just replace "be right back".
On second thought, you don't even need to check for it. If it's there it will be replaced, if it's not, it won't. Simple.
I don't fully understand the second bit...
You just want to put "BRB" into a UIAlertView?
Also, try using the [ CODE ] tags (no spaces), it makes your code a lot easier to read
Tom
Oh lol sorry. Actually I got it. Thanks so much dude! It worked just right. Thanks you! If it wasn't for you I would have never have finished my app.