ここに私MainClassコードがPinterestで画像を投稿するには?
- (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];
}
あるだから私のWebViewControllerに画像を通過した後、今の私WebViewControllerクラスコードが
である私は thisリンクを使用してPinterestの上の画像を投稿したいが、私は自分の要件に応じて少しのコード変更- (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];
}
私は私のWebViewをコーディング上記を使用して何の画像と私のWebViewのはscreenshow
以下のように見えません示してWebViewControllerの画像ビューに同じ画像インスタンスを割り当てると、そのimageview.image = mypimage;
なぜ私のwebveiwに画像が表示されないのかを教えてくれる人もいます。ありがとうございます。
これは適切なボタンURLではないと言わざるを得ない。実際に質問を投稿する前に、ロードしようとしているリソースのURLが存在することを確認してください。 –
最初のスクリーンショットにあるピンチボタンをクリックすると、2番目のスクリーンショットが開きます。これは、問題がないことを意味します。私のイメージは渡されません。 – jamil