Swift UIActionSheet:添加第二行文本和一个Button

时间:2015-05-14 21:08:36

标签: ios swift uiactionsheet

我希望为每个ActionSheet操作添加较小尺寸的第二行文本。我无法使用\n

获取第二行文字

此外,我希望每个动作的右侧都有一个按钮。

我怎样才能做到这一点?

let playMenu = UIAlertController(title: title, message: message, preferredStyle: .ActionSheet)

        let Action1 = UIAlertAction(title: button1, style: .Default, handler: {
            (alert: UIAlertAction!) -> Void in
            self.playRecording(num)
        })

        let Action2 = UIAlertAction(title: button2, style: .Default, handler: {
            (alert: UIAlertAction!) -> Void in
            self.shareRecording()
        })

        let Action3 = UIAlertAction(title: button3, style: .Destructive, handler: {
            (alert: UIAlertAction!) -> Void in
            self.deleteRecording()
        })

        let cancelAction = UIAlertAction(title: cancelButton, style: .Cancel, handler: {
            (alert: UIAlertAction!) -> Void in
            println("Cancelled")
        })


        playMenu.addAction(Action1)
        playMenu.addAction(Action2)
        playMenu.addAction(Action3)
        playMenu.addAction(cancelAction)

        playMenu.popoverPresentationController?.sourceView = self.view
        playMenu.popoverPresentationController?.sourceRect = CGRectMake(self.view.bounds.width / 2.0, self.view.bounds.height, 1.0, 1.0)

        self.presentViewController(playMenu, animated: true, completion: nil)

0 个答案:

没有答案