如何在scrollView的末尾添加Facebook Like按钮?
我正在使用基于导航的应用程序。每个单元格都会创建一个详细视图。我有 3 个详细文本视图,其中显示标题、日期和说明。我将 textView 放在滚动视图中,以便用户可以将它们作为单个视图滚动。现在我想要在scrollView 的末尾有一个facebook 图标。如果单击该图标并且用户已经登录 Facebook,则应该自动喜欢该 Facebook 页面。如果用户未登录,则应询问帐户信息。我对此很陌生,这是我的第一个应用程序。我尝试探索developer.facebook.com,但无法获得该功能。有人能帮我解决这个问题吗?提前致谢。
I am working with navigation based application. Every cell creates a detailView. i have 3 text views in detailView which show title, date and description. I put there textViews in a scrollView so user can scroll them as a single view. Now i want a facebook icon in the end of scrollView. If that icon is clicked and user is already login on facebook, that facebook page should be liked automatically. and if user is not login, it should ask for account information. I am quite new in this and this is my first app. i tried to explore developer.facebook.com but couldn't get that functionality. Can anybody help me with this? thanx in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要实现按钮本身,您将使用 Facebook Like 图形作为其图像向应用程序添加自定义 UIButton。
处理触摸事件的选择器需要处理 NSRequest。您需要查明用户是否已登录。如果用户登录到 Facebook,您的选择器将向 Facebook 的 API 发出 NSRequest 以喜欢 Facebook 页面。如果用户未登录,您需要向用户提供一些 UIView 来处理 Facebook 的身份验证。当您知道身份验证成功后,您可以向 Facebook API 发出 NSRequest 来喜欢该页面。
有关在 iOS 应用程序中使用 Facebook API 的更多信息,您应该查看 Facebook iOS SDK,网址为 https: //github.com/facebook/facebook-ios-sdk。 Facebook 的 iOS SDK 包括身份验证和广泛的 API 支持,可帮助您更轻松地工作。
To implement the button itself, you'll add a custom UIButton to your application using the Facebook Like graphic as its image.
Your selector that handles the touch event will need to handle the NSRequest. You'll need to find out if the user is logged in or not. If the user is logged in to Facebook, your selector will make an NSRequest to Facebook's API for liking the Facebook page. If the user is not logged in, you'll need to instead provide the user some UIView that will handle authentication with Facebook. When you know authentication is successful, you can then issue the NSRequest to the Facebook API for liking the page.
For more information on using the Facebook API in your iOS application, you should check out Facebook iOS SDK at https://github.com/facebook/facebook-ios-sdk. Facebook's iOS SDK includes authentication and extensive API support to help make your job easier.