1 SLComposeServiceViewController
- Presenting the Compose View
- Posting or Canceling a Post
- Validating Content
- Previewing Attachments
- Enabling Additional Configuration
- Enabling Text Autocompletion
- Accessing Content in the Compose View
2 SLComposeSheetConfigurationItem
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
Related Documentation
SLComposeServiceViewController Class Reference
SLComposeSheetConfigurationItem Class Reference
Revision History
时间 | 描述 |
---|---|
2016-01-24 | 博文完成 |
2016-01-25 | 添加SLComposeSheetConfigurationItem |