views:

15

answers:

0

Using the following method in xcode im trying to generate some text once the user presses the return key on the key pad. However for some reason the key pad is disabled and I cannot get it to work again without removing the code:

  • (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {

    BOOL shouldChangeText = YES;

    if ([text isEqualToString:@"\n"]) {
    // Find the next entry field

    txtDetail.text = [txtDetail.text stringByAppendingString:@"\nhey\n"];       }  
    textView.editable = YES;
    
    
    shouldChangeText = NO; 
    

    [textView becomeFirstResponder];

    return shouldChangeText;
    }

Is there another way to insert text once the user presses the return key?

Thanks