Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9291965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T20:46:11+00:00 2026-06-18T20:46:11+00:00

i want to post image on pinterest using this link but i change coding

  • 0

i want to post image on pinterest using this link but i change coding Little bit according to my own Requirement here is my MainClass code

- (void)pInterest {
      UIImage *myImage;
      myImage=imgView.image;
      WebViewController *webViewController = [[WebViewController alloc] initWithNibName:@"WebViewController" bundle:nil];
      webViewController.mypimage = myImage;
     [[[[UIApplication sharedApplication] keyWindow] rootViewController] presentModalViewController:webViewController animated:YES];
}

So after passing image to my WebViewController now my WebViewController class code is

- (void)viewDidLoad {
     //imageview.image=mypimage;
     [super viewDidLoad];
     NSString *description = @"Post your description here";

     // Generate urls for button and image
     NSString *sUrl = [NSString stringWithFormat:@"http://d30t6wl9ttrlhf.cloudfront.net/media/catalog/product/Heros/mypimage"];
     // NSLog(@"URL:%@", sUrl);
     NSString *protectedUrl = (__bridge NSString *)CFURLCreateStringByAddingPercentEscapes(NULL,(__bridge CFStringRef)sUrl, NULL, (CFStringRef)@"!*'\"();:@&=+$,/?%#[]% ",CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding));
     NSLog(@"Protected URL:%@", protectedUrl);
     NSString *imageUrl = [NSString stringWithFormat:@"\"%@\"", sUrl];
     NSString *buttonUrl = [NSString stringWithFormat:@"\"http://pinterest.com/pin/create/button/?url=www.flor.com&media=%@&description=%@\"", protectedUrl, description];

     NSMutableString *htmlString = [[NSMutableString alloc] initWithCapacity:1000];
     [htmlString appendFormat:@"<html> <body>"];
     [htmlString appendFormat:@"<p align=\"center\"><a href=%@ class=\"pin-it-button\" count-layout=\"horizontal\"><img border=\"0\" src=\"http://assets.pinterest.com/images/PinExt.png\" title=\"Pin It\" /></a></p>", buttonUrl];
     [htmlString appendFormat:@"<p align=\"center\"><img width=\"400px\" height = \"400px\" src=%@></img></p>", imageUrl];
     [htmlString appendFormat:@"<script type=\"text/javascript\" src=\"//assets.pinterest.com/js/pinit.js\"></script>"];
     [htmlString appendFormat:@"</body> </html>"];
     [mywebview setBackgroundColor:[UIColor clearColor]];
     [mywebview loadHTMLString:htmlString baseURL:nil];
     [mywebview setOpaque:NO];
}

When i use the above coding my webview show no image and my webview looks like below screenshow
enter image description here enter image description here

When i assign the same image instance to image view in WebViewController its working imageview.image=mypimage;

So can some one suggest me why my webveiw not show the image.Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T20:46:12+00:00Added an answer on June 18, 2026 at 8:46 pm

    use this code…… Hope it will help you.

    - (IBAction)pinit:(id)sender {
        [self postToPinterest];
    }
    
    - (IBAction)closeWebVIew:(id)sender {
        [webViewPinterest setHidden:YES];
    }
    
    - (NSString*) generatePinterestHTML {
       NSString *description = @"Post your description here";
     NSURL* sUrl = [NSString stringWithFormat:@"http://4.bp.blogspot.com/-w4oTZjlpgwo/T5_pi-KJPuI/AAAAAAAAAoM/rKm3E0XCbgY/s1600/red_rose_flower3.jpg"];// pass your link here with your image name
    
        NSLog(@"URL:%@", sUrl);
       NSString *protectedUrl = ( NSString *)CFURLCreateStringByAddingPercentEscapes(NULL,( CFStringRef)sUrl, NULL, (CFStringRef)@"!*'\"();:@&=+$,/?%#[]% ",CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding));
        NSLog(@"Protected URL:%@", protectedUrl);
        NSString *imageUrl = [NSString stringWithFormat:@"\"%@\"", sUrl];
        NSString *buttonUrl = [NSString stringWithFormat:@"\"http://pinterest.com/pin/create/button/?url=www.flor.com&media=%@&description=%@\"", protectedUrl, description];
    
        NSMutableString *htmlString = [[NSMutableString alloc] initWithCapacity:1000];
        [htmlString appendFormat:@"<html> <body>"];
        [htmlString appendFormat:@"<p align=\"center\"><a href=%@ class=\"pin-it-button\" count-layout=\"horizontal\"><img border=\"0\" src=\"http://assets.pinterest.com/images/PinExt.png\" title=\"Pin It\" /></a></p>", buttonUrl];
        [htmlString appendFormat:@"<p align=\"center\"><img width=\"400px\" height = \"400px\" src=%@></img></p>", imageUrl];
        [htmlString appendFormat:@"<script type=\"text/javascript\" src=\"//assets.pinterest.com/js/pinit.js\"></script>"];
        [htmlString appendFormat:@"</body> </html>"];
        return htmlString;
    }
    
    - (void) postToPinterest {
        NSString *htmlString = [self generatePinterestHTML];
        NSLog(@"Generated HTML String:%@", htmlString);
        webViewPinterest.backgroundColor = [UIColor clearColor];
        webViewPinterest.opaque = NO;
        if ([webViewPinterest isHidden]) {
            [webViewPinterest setHidden:NO];
        }
        [webViewPinterest loadHTMLString:htmlString baseURL:nil];
        //[webViewPinterest loadHTMLString:@"<img src=images.png>" baseURL:nil];
    }
    
    - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
        return YES;
    }
    
    - (void)webViewDidStartLoad:(UIWebView *)webView {
        [busyIndicator startAnimating];
    }
    
    -(void)webViewDidFinishLoad:(UIWebView *)webView {
        [busyIndicator stopAnimating];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I simply want to post an image and comment from my own site to
With php file_get_contents() i want just only the post and image. But it's get
I want to post a link including an image to Facebook timeline: UIImage *img
I want to disable the button maximize/minimize, below I post image to explain this
I want to post some text with image on Facebook wall. I have this
I want to retrieve url to last post image with get_post_meta method, but I
I want to post on twitter wall but don't want that user can edit
I want to post a message on the user's facebook wall using access token.
I want to post a message on my wall, adding a PNG image (
I want to post image to the Facebook in which I am having my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.