Skip to content

Instantly share code, notes, and snippets.

@burhanaksendir
Created May 28, 2015 16:39
Show Gist options
  • Save burhanaksendir/5253d780c50f45b7910e to your computer and use it in GitHub Desktop.
Save burhanaksendir/5253d780c50f45b7910e to your computer and use it in GitHub Desktop.
@IBAction func shareFacebook(sender: AnyObject) {
if SLComposeViewController.isAvailableForServiceType(SLServiceTypeFacebook){
var facebookSheet: SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeFacebook)
facebookSheet.setInitialText("Demo")
self.presentViewController(facebookSheet, animated: true, completion: nil)
} else {
var alert = UIAlertController(title: "Hata", message: "Facebook aktif değil", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "Tamam", style: UIAlertActionStyle.Default, handler: nil))
self.presentViewController(alert, animated: true, completion: nil)
}
//Bu aşağıdaki kodu yazınca herşey dismiss oluyor :) Yani açılan Facebook Share penceresi de. Bari o kalsaydı.
self.dismissViewControllerAnimated(true, completion: nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment