Skip to content

Instantly share code, notes, and snippets.

@dannycabrera
Last active October 27, 2016 13:38
Show Gist options
  • Save dannycabrera/a4cbec764a2c0ad25d151ceeaf4843c1 to your computer and use it in GitHub Desktop.
Save dannycabrera/a4cbec764a2c0ad25d151ceeaf4843c1 to your computer and use it in GitHub Desktop.
Save RTF from UITextView using NSFileWrapper on Xamarin.iOS
NSError error1 = null;
NSError error2 = null;
var atts = new NSAttributedStringDocumentAttributes ();
atts.DocumentType = NSDocumentType.RTF;
using (var wrapper = textView.AttributedText.GetFileWrapperFromRange (new NSRange (0, textView.Text.Length), atts, ref error1))
{
wrapper.Write (new NSUrl ("...Edited.rtf", false), NSFileWrapperWritingOptions.Atomic, new NSUrl ("...Sample.rtf", false), out error2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment