I am newly to iPhone. I have added one UITextView using XIB in my application, now after tapping on done key it's simply resigning the keyboard. But, I want to create a new line by tapping it, means it should go to the next paragraph. Please help me to achieve my output. Here is my code :
- (void)textViewDidEndEditing:(UITextView *)textView1
{
if (![textView1 hasText]) {
[textView1 addSubview:placeholderLabel];
}
else{
NSLog(@"done button clicked!!");
}
CGRect rect;
if(screenBounds.size.height == 568)//iPhone5
{
rect = CGRectMake(5, 76, 310, 491);
}
else{
if(_kisiOS7){
rect = CGRectMake(5, 76, 310, 404);
}
else{
rect = CGRectMake(0, 44, 320, 436);
}
}
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
txtView.frame = rect;
[UIView commitAnimations];
}
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
if (range.length == 0) {
if ([text isEqualToString:@"\n"]) {
[textView resignFirstResponder];
return NO;
}
}
return YES;
}
Thanks in advance.