views:

63

answers:

1

Hi there,

Can I have a double-spaced UITextView? I mean, so that it retains its formatting when I edit it?

I need to display graphical elements in between the lines of text. Any ideas?

Thanks!

A: 

Sorry Replied to wrong question.

Answer is for question here: http://stackoverflow.com/questions/2576561/iphone-disable-the-double-tap-spacebar-for-shortcut/3023716#3023716

Put this in your delegate class:

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{


 //Check for double space

 if (range.location > 0 && [[NSCharacterSet whitespaceCharacterSet] characterIsMember:[string characterAtIndex:0]] && [[NSCharacterSet whitespaceCharacterSet] characterIsMember:[[textField text] characterAtIndex:range.location - 1]])
  return NO;

return YES;
}
Chaise