在swift中打开分享功能原来是如此的简单。
1、首先需要
import Social2、在分享按钮事件下面
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才行。

本文介绍了如何在Swift中使用内置的Social框架轻松实现社交媒体分享功能。通过简单的几步操作即可将内容分享到包括新浪微博在内的多个社交平台。
2985

被折叠的 条评论
为什么被折叠?



