Menu

UIWebView LoadData method

2013-07-26
2013-07-26
  • Lucio Feitoza

    Lucio Feitoza - 2013-07-26

    Hi everybody.

    I need to show a rtf text i get from a webservice, and i found out that the webView LoadData method can do this.

    I got this code below from a .net app i am migrating to delphi, and it loads the rtf text into the webview:

    string strRTF = item["TEXTO"].ToString ();
    strRTF = strRTF.Replace ("<CR><LF>","\r\n");
    NSData nsd = NSData.FromString (strRTF);
    string basedir = Environment.GetFolderPath (System.Environment.SpecialFolder.Personal);
    basedir = System.IO.Path.Combine (basedir, "..", "myapp.app"); // USE YOUR APP BUNDLE NAME
    WebV.LoadData ( nsd,"text/rtf","utf-8", new NSUrl("http://localhost/"));
    WebV.Hidden = false;
    WebV.ScalesPageToFit = true;

    Do you think it is possible to add thie LoadData to the DPF DPFWeb component?
    thank you for your components, they are great!
    Lucio

     
  • Lucio Feitoza

    Lucio Feitoza - 2013-07-26

    I just found out that the UITextView is also capable of displyaing RTF text, but you need to set its SetRichText method in order to enable it to display the rtf text.
    However the DPF UiTextView component does not have this setrichtext method. Is it possible to import it?
    I haven´t tested this feature, but i got it from this apple site below
    https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/TextUILayer/Tasks/PlainRichText.html

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.