1

Is there a really easy way to insert an <hr> separation in an UITextView ?

I tried something like this, but it's not really pretty :

[textToInclude appendString:[NSString stringWithFormat:@"________________________________________ \n Total: %0.3f", total]];
[self.myUITextView setText:textToInclude];
Mehmet Emre Portakal
  • 1,774
  • 21
  • 37
Ritooon
  • 155
  • 12

2 Answers2

1

Finally, as this UITextView as "read-only", I used an UIWebView, doing like this :

 NSString *contentView = [[NSString alloc] init];
 contentView = [NSString stringWithFormat:@"<html><body ><p style=\"color:grey; font-style:italic;\">Some datas</p><hr/><p style=\"font-size:14px;\">  Total: %0.3f </p></body></html>", total];
 [self.myUITextView loadHTMLString:contentView baseURL:nil];
 [self webViewDidFinishLoad:self.existingEntries];
Ritooon
  • 155
  • 12
0

Write the content you want as HTML in an NSString. Here's a link to some code to help: https://stackoverflow.com/a/18886718/417085

Community
  • 1
  • 1
Cocoadelica
  • 3,006
  • 27
  • 30
  • Seems it doesn't work ... Because, I want to add an hr separation, not the html tag in the text.. – Ritooon Mar 18 '14 at 14:23