title: Text Formatting Using UITextView
body: <p>I have a <code>UITextView</code> where user enter data. I have a format bar below which has 
  bold, italic, underline and other options like alignment etc. 
  After a lot of search and testing I came to know that <code>NSString</code> don't support such bold, italic styling instead <code>NSAttributedString</code> should be used but I use <code>NSAttributedString</code> I am unable to make the selected text bold and italic at the same time. </p>
  
  <p>My code is like this </p>
  
  <pre><code>NSMutableAttributedString *textViewText = [[NSMutableAttributedString alloc]initWithAttributedString:textView.attributedText];
  
  NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:text];
  
  NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
  
      if(textBoldBtn){
  
          UIFont *boldFont = [UIFont boldSystemFontOfSize:textView.font.pointSize];
          NSDictionary *boldAttr = [NSDictionary dictionaryWithObject:boldFont forKey:NSFontAttributeName];
  
          [dict addEntriesFromDictionary:boldAttr];          
      }
      if(textItalicBtn){
  
          UIFont *italicFont = [UIFont italicSystemFontOfSize:textView.font.pointSize];
  
          NSDictionary *italicAttr = [NSDictionary dictionaryWithObject:italicFont forKey:NSFontAttributeName];
          [dict addEntriesFromDictionary:italicAttr]; 
      }   
      attributedText = [[NSMutableAttributedString alloc] initWithString:text attributes:dict];     
      [textViewText appendAttributedString:attributedText];
      textView.attributedText = textViewText;
  
      return true;
  }
  </code></pre>
  
  <p>Using this technique it only takes the last font in dict when both buttons are pressed. </p>
  
  <p>I have gone through a link on stack overflow where they use fontDescriptor of Label to make the text both italic and bold but note I don't want to use any label. I am using <code>UITextView</code>. I have also gone through 
  <code>[textView setAllowsEditingTextAttributes:YES];</code>
  But I want my own functions. I have also seen several <em>EGOTextView</em> and <em>TextEdit</em> for iOS but I strictly want this for iPad. I only want to use <code>UITextView</code>.</p>
  
  <p>Kindly tell if there is any way using attributed string to make text both italic bold and even underline at the same time or any way to customize the functions of textView personal EditingTextAttributes functionality.</p>
  
  <p>Thanks in Advance. </p>
  
  <p>*App has to be uploaded to app store so no private frameworks required because they would cause rejection of app.</p>