Hi How do I set return key to a new line to UITextView below? Thanks
-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
if (range.length == 0) {
if ([text isEqualToString:@"\n"]) {
[textView resignFirstResponder];
NSIndexPath *path = [NSIndexPath indexPathForRow:0 inSection:0];
[self.tableView scrollToRowAtIndexPath:path atScrollPosition:UITableViewScrollPositionTop animated:YES];
[self.tableView setScrollEnabled:NO];
return NO;
}
}
return YES;
}
You can make done button on navigation bar to hide keyBoard.
Because next button on keyBoard in UITextView
will give you new line.
EDIT
Remove this line from your code, it will resigning your keyboard when you are pressing next button
[textView resignFirstResponder];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With