How to add the Facebook Like Button in the end of scrollView?

761 views Asked by At

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.

1

There are 1 answers

0
bobwaycott On BEST ANSWER

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.