title: How to underline part of string with NSAttributedString objective-c
body: <p>Underling a string only works when the range starts from zero. If i start it at 1 then it works. The green colour works regardless. </p>
  
  <pre><code>+ (NSAttributedString*)returnNSAttributedString:(NSString*)string range:(NSRange)range WithColour:(UIColor*)colour WithUnderLine:(BOOL)underline {
      NSMutableAttributedString *attributedString =
      [[NSMutableAttributedString alloc] initWithString:string];
      if (underline) {
          [attributedString addAttributes:@{NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle)} range:range];
      }
      [attributedString addAttribute:NSForegroundColorAttributeName value:colour range:range];
      [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSRangeFromString(string)];
      return attributedString;
  }
  </code></pre>
  
  <p>it works on iOS 7 not iOS 8.</p>