UITextView delegate methods

Connect the delegate of the TextView in Interface Builder to the parent class. I like to use the connection in IB rather than code it. To me the less code to look at the better :). Also - don't compare strings that way. Use isEqualToString for string comparison:

if ([myTextView.text isEqualToString:@"TEXT"]) {
        [myTextView setText:@""];
}

Connection Pic

Here is the fixed project:


this method is missing from your Test2ViewController.m file:

- (void)viewDidLoad {
    [myTextView setDelegate:self];
}

or you can connect the delegate in the Interface Builder as well, if you prefer that way better.

UPDATE #1:

add this method to you class for controlling the return key.

- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
    if ([text isEqualToString:@"\n"]) {
        NSLog(@"Return pressed, do whatever you like here");
        return NO; // or true, whetever you's like
    }

    return YES;
}