加入Facebook的Like按钮在iPhone应用程序

加入Facebook的Like按钮在iPhone应用程序

本文介绍了加入Facebook的Like按钮在iPhone应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道我是如何将包括一个iPhone应用程序一个facbeook喜欢按钮。我打过电话里面的iframe一个的UIWebView 但是,这并不正常工作。

Does anyone know how I would include a facbeook "like button" in an iphone app. I tried calling the iframe inside of a UIWebView but that doesn't work.

推荐答案

看看code的这个漂亮位:
http://angelolloqui.blogspot.com/2010/11/facebook-like-button-on-ios.html

Check out this nice bit of code:http://angelolloqui.blogspot.com/2010/11/facebook-like-button-on-ios.html

添加 FBLikeButton 类到您的视图:

FBLikeButton *likeButton = [[FBLikeButton alloc] initWithFrame:CGRectMake(0, 372, 320, 44)
andUrl:@"http://www.facebook.com/pages/De-Zilk/108209735867960"];

非常感谢天使加西亚Olloqui

Thanks a lot Angel García Olloqui

编辑:尼斯添加...奖励积分:结果
如果你使用上面的方法网页没有很好地格式化为iPhone。你可以做的是运行一些JavaScript code删除所有令人不安的div。使用这个(长句):

Nice to add... For bonus points:
If you use above method the webpage is not well formatted for an iPhone. What you can do is run some JavaScript code to remove all the disturbing divs. Use this (long sentence):

  [_webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"javascript:document.getElementsByClassName('uiButton')[2].style.visibility='hidden';var child1 = document.getElementById('standard_status');var parent1 = document.getElementById('login_form');parent1.removeChild(child1);var child2 = document.getElementById('pageheader');var parent2 = document.getElementById('booklet');parent2.removeChild(child2);document.getElementById('loginform').style.width = '200px';var child3 = document.getElementById('reg_btn_link');var parent3 = document.getElementsByClassName('register_link')[0];parent3.removeChild(child3);var child4 = document.getElementById('signup_area');var parent4 = document.getElementById('login_form');parent4.removeChild(child4);var child5 = document.getElementsByClassName('mbm')[0];var parent5 = document.getElementById('loginform');parent5.removeChild(child5);var child6 = document.getElementsByClassName('reset_password form_row')[0];var parent6 = document.getElementById('loginform');parent6.removeChild(child6);var child7 = document.getElementsByClassName('persistent')[0];var parent7 = document.getElementById('loginform');parent7.removeChild(child7);"]];

您可以将其放置在委托方法 webViewDidFinishLoad FBDialog Facebook类。

You can place it in the delegate method webViewDidFinishLoad from the FBDialog Facebook class.

这篇关于加入Facebook的Like按钮在iPhone应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 21:01