有谁知道如何在iPhone应用程序中包含一个"按钮".我尝试在内部调用iframe,UIWebView
但这不起作用.
看看这个很好的代码: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"];
非常感谢AngelGarcíaOlloqui
编辑:很高兴添加...奖励积分:
如果您使用上述方法,网页格式不适合iPhone.你可以做的是运行一些JavaScript代码来删除所有令人不安的div.使用此(长句):
[_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类.