I am trying to Insert Text in new line without removing the previous text in Text View. I am very new in iOS so I am faciing little difficulty to solve this problem. Thanks in advance
You can do it quite easily by using the following code :
NSString *oldText,*newText,*myString;
- (IBAction)addNewItem:(id)sender {
[self updateTextField];
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField resignFirstResponder];
return YES;
}
-(void)updateTextField
{
oldText=displayTextView.text;
newText=entryTextField.text;
myString = [newText stringByAppendingFormat:@"\n"];
myString = [myString stringByAppendingString:oldText];
displayTextView.text=myString;
}