Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Show HTML formatted code on UIWebView in iPhone

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 189
    Comment on it

    Steps to create HTML file and display on UIWebView.

    Step1. Add New File -> Resource -> Rich Text File.
    Step2. Change .txt extension to .html.
    Step3. Enter your HTML code as written below.

    <html><head><style>{text-align:left}</style></head>
    <body>
        <font face="HoboStd" size='3'><font color="#0888E4">text</font></font><font face="HoboStd" color="#494043" size='3'>share</font>
        <font face="CenturyGothic" size='1'><font color="#494043">choose snippet to share</font></font>
        <font face='CenturyGothic' size='1.8' color='#494043'>
        <p>
        Share text or Facebook messages with friends in a few simple steps.  Snap screenshots of your text message and then choose them to send to friends or choose the message and section of a Facebook message to share.  Then, choose the friends you want to share with and send off.  Your friends will receive the messages and will be able to comment back to you on them.
        </p>
    </body>
    

    Step4. Write below code to show HTML file on UIWebView

    UIWebView *view = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 220, 150)];
        view.backgroundColor = [UIColor colorWithRed:227/255.0 green:220/255.0 blue:220/255.0 alpha:1];
        view.layer.cornerRadius = 5.f;
        view.layer.borderColor = [UIColor blackColor].CGColor;
        view.layer.borderWidth = 1.f;
        NSURL *htmlFile = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"HideTextShareLayer" ofType:@"html"]];
        [view loadRequest:[NSURLRequest requestWithURL:htmlFile]];
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: