Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     NSMutableAttributedString *finalAttributedString = [[NSMutableAttributedString alloc] initWithString:@""];
  2.    
  3.     //Do the title thing
  4.    
  5.     NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"AlMolk" ofType:@"plist"];
  6.     NSArray *verses = [NSArray arrayWithContentsOfFile:plistPath];
  7.     for (NSUInteger i = 0; i < [verses count]; i ++)
  8.     {
  9.         NSAttributedString *attr = [[NSAttributedString alloc] initWithString:verses];
  10.         [finalAttributedString appendAttributedString:attr];
  11.         NSTextAttachement *attachement = [NSTextAttachement alloc] init];
  12.         NSString *imageName = [NSString stringWithFormat:verse_%02lu",(unsigned long)verseIndex];
  13.        [attachement setImage:[UIImage imageNamed:imageName]]; //Here is supposed your images were named verse01.png etc in your app + you wan mant to resize them
  14.        NSAttributedString *attachmentString = [NSAttributedString attributedStringWithAttachment:attachment];
  15.        [finalAttributedString appendAttributedString:attachmentString];
  16.    }
  17.    
  18.    NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
  19.    [style setAlignement:NSTextAlignmentJustified];
  20.    NSDictionary *attributes = @{NSFontAttributeName:[UIFont [UIFont fontWithName:@"Scheherazade-Regular" size:19], NSParagraphAttributeName:style};
  21.    
  22.    [finalAttributedString addAttributes:attributes range:NSMakeRange(0, [finalAttributedString length])];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement