I'm trying to put in some line spaces between various quotes that get collected. The code I use is:
if (!self.theArray) {
self.theArray = [[NSMutableArray alloc] init];
}
NSString *doIt = [NSString stringWithFormat:@"%@ - %@ %@:%@", self.textstring, self.bookstring, self.chapterstring, self.versestring];
[self.theArray addObject:doIt];
NSString *theEnd = [self.theArray componentsJoinedByString:@"\n"];
NSString *loadHTML = [@"<head> <style type='text/css'>a > img {pointer-events: none;cursor: default;}</style></head><b><div align=\"left\"><font size=5>" stringByAppendingString:theEnd];
NSAttributedString *attributedString = [[NSAttributedString alloc] initWithData:[loadHTML dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
textView.attributedText = attributedString;
[self performSelector:@selector(startTheProcess) withObject:self afterDelay:1.0];
NSLog(@"ARRAY: %@", self.theArray);
NSLog(@"String: %@", theEnd);
In the log of both the array and the NSAttributedString it shows the line breaks, but when the UIWebView shows it, the line breaks are removed.
Replace the line
NSString *theEnd = [self.theArray componentsJoinedByString:@"\n"];
with this,
NSString *theEnd = [self.theArray componentsJoinedByString:@"<br>"];