【问题标题】:Sharing html in facebook在 facebook 中分享 html
【发布时间】:2013-01-10 05:49:26
【问题描述】:

在我的 iPad 应用程序中,我正在加载 HTML5 页面,我想将这些页面分享到 Facebook。是否可以?我搜索了很多,但找不到任何帮助。我的应用应该支持 iOS5 或更高版本。任何帮助将不胜感激。

我在下面分享一张图片。

    FbGraphFile *graph_file = [[FbGraphFile alloc] initWithImage:picture];
    [variables setObject:graph_file forKey:@"file"];
    [variables setObject:@" image : Shared Via IOS application" forKey:@"message"];
    FbGraphResponse *fb_graph_response = [fbGraph doGraphPost:@"117795728310/photos" withPostVars:variables];

【问题讨论】:

  • 请澄清您的问题。 Facebook 允许共享 HTML 链接或媒体。你HTML5 pages的格式是什么?

标签: iphone ios objective-c html ipad


【解决方案1】:

我遇到了同样的问题,solutionrender HTML5 pagesUIWebView 中,当它从它加载 capture image 时,然后是 share

+(UIImage *)imageFromWebView:(UIWebView *)view
{
  // tempframe to reset view size after image was created
  CGRect tmpFrame         = view.frame;

  // set new Frame
  CGRect aFrame               = view.frame;
  aFrame.size.height  = [view sizeThatFits:[[UIScreen mainScreen] bounds].size].height;
  view.frame              = aFrame;

  // do image magic
  UIGraphicsBeginImageContext([view sizeThatFits:[[UIScreen mainScreen] bounds].size]);

  CGContextRef resizedContext = UIGraphicsGetCurrentContext();
  [view.layer renderInContext:resizedContext];
  UIImage *image = UIGraphicsGetImageFromCurrentImageContext();

  UIGraphicsEndImageContext();

  // reset Frame of view to origin
  view.frame = tmpFrame;
  return image;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-04-25
    • 1970-01-01
    • 2014-08-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-02
    • 2023-03-20
    相关资源
    最近更新 更多