如何将视图控制器推送到SLComposeServiceViewController?

时间:2015-11-03 13:30:28

标签: ios swift ios8-share-extension

这就是我现在所拥有的:

enter image description here

但我更喜欢这样:

enter image description here

当我点击选项时,我将一个新的UIViewController推入堆栈:

这就是我的configurationItems()方法的样子:

override func configurationItems() -> [AnyObject]! {

    let composeSheet = SLComposeSheetConfigurationItem()
    composeSheet.title = "firstItem"
    composeSheet.value = "defaultValue"

    let composeSecondSheet = SLComposeSheetConfigurationItem()
    composeSecondSheet.title = "secondItem"

    return [composeSheet, composeSecondSheet]
}

1 个答案:

答案 0 :(得分:1)

这就是它需要做的事情:

let composeSheet = SLComposeSheetConfigurationItem()
composeSheet.title = "firstItem"
composeSheet.value = "defaultValue"
composeSheet.tapHandler = {
    self.pushConfigurationViewController(UIViewController())
}

分配点击处理程序后,它会自动创建右箭头:

enter image description here

当您按下composeSheet时,您将控制器推入导航堆栈:

enter image description here