ios学习:swift中实现分享到微博、facebook,twitter等
时间:2014-10-29 14:52:09
收藏:0
阅读:331
在swift中打开分享功能原来是如此的简单。
1、首先需要
import Social
2、在分享按钮事件下面
var controller:SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeSinaWeibo) controller.setInitialText("一起来swift吧!") controller.addImage(UIImage(named: "app720_12801")) self.presentViewController(controller, animated: true, completion: nil)
这样就打开了分享到新浪微博窗口
swift 中自带的有4个值,分别为
SLServiceTypeTwitter
SLServiceTypeFacebook
SLServiceTypeSinaWeibo
SLServiceTypeTencentWeibo
一看就明白了,但是要分享到微信应该还要看微信的api才行。原文:http://blog.csdn.net/miw__/article/details/40585487
评论(0)