SLComposeServiceViewController

1 SLComposeServiceViewController

  1. Presenting the Compose View
  2. Posting or Canceling a Post
  3. Validating Content
  4. Previewing Attachments
  5. Enabling Additional Configuration
  6. Enabling Text Autocompletion
  7. Accessing Content in the Compose View

2 SLComposeSheetConfigurationItem

  1. Responding to User Interaction
  2. Specifying Configuration Information
  3. Getting a Configuration Item

1 SLComposeServiceViewController

SLComposeServiceViewController可以在共享平台将其他应用的数据共享到我们的应用中,如下图所示。

有一个可编辑文本框、一张照片、取消和确定按钮。点击确定既可将相关内容分享到我们的App中,我们还可以定制界面。

相关数据的传播经过NSExtensionContext类。

1 Presenting the Compose View

/// 展示动画执行完毕
public func presentationAnimationDidFinish()

2 Posting or Canceling a Post

/// 点击发布按钮
public func didSelectPost()

/// 点击取消按钮
public func didSelectCancel()

/// 关闭分享界面
public func cancel()

3 Validating Content

/// 判断当前内容是否有效
public func isContentValid() -> Bool

/// 内容校验
public func validateContent()

/// 剩下可写入字符数
public var charactersRemaining: NSNumber!

4 Previewing Attachments

/// 附近View
public func loadPreviewView() -> UIView!

5 Enabling Additional Configuration

/// 配置[SLComposeSheetConfigurationItem]
public func configurationItems() -> [AnyObject]!

/// 刷新[SLComposeSheetConfigurationItem]
public func reloadConfigurationItems()

/// 进入下一个视图
public func pushConfigurationViewController(viewController: UIViewController!)

/// 回到上个视图
public func popConfigurationViewController()

6 Enabling Text Autocompletion

/// 扩展界面
public var autoCompletionViewController: UIViewController!

7 Accessing Content in the Compose View

/// UITextView框
public var textView: UITextView! { get }

/// 内容
public var contentText: String! { get }

/// 默认显示
public var placeholder: String!

2 SLComposeSheetConfigurationItem

SLComposeSheetConfigurationItem主要是在SLComposeServiceViewController分享扩展界面添加选择条目时使用如图中的”选择”就是SLComposeSheetConfigurationItem控件。

2.1 Responding to User Interaction

/// 用户点击列表回调
public var tapHandler: SLComposeSheetConfigurationItemTapHandler!

2.2 Specifying Configuration Information

/// 左标题
public var title: String!
/// 右描述
public var value: String!
/// 是否开启转圈模式
public var valuePending: Bool

2.3 Getting a Configuration Item

/// 初始化
public init!()

 


Appendix

Sample Code

Swift

Social Framework Reference

SLComposeServiceViewController Class Reference

SLComposeSheetConfigurationItem Class Reference

Revision History

时间描述
2016-01-24博文完成
2016-01-25添加SLComposeSheetConfigurationItem

CSDN:http://blog.csdn.net/y550918116j

GitHub:https://github.com/937447974/Blog

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值