Swift:没有查看SLKTextViewController的左键

时间:2015-08-17 00:28:57

标签: ios swift uibutton

我正在使用SLKTextViewController用两个按钮构建聊天停靠视图。

我希望左侧按钮UIPopOverController拍照等等。

class Message: SLKTextViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
          self.textView.placeholder = "Message"
        self.textView.placeholderColor = UIColor.lightGrayColor()
        self.leftButton.setImage(UIImage(named: "icn_upload"), forState: UIControlState.Normal)
        self.leftButton.tintColor = UIColor.grayColor()
        self.rightButton.setTitle("Send", forState: UIControlState.Normal)
        self.textInputbar.autoHideRightButton = true
        self.textInputbar.maxCharCount = 31
        self.textInputbar.counterStyle = SLKCounterStyle.Split
        self.typingIndicatorView.canResignByTouch = true
        self.bounces = true
        self.shakeToClearEnabled = true
        self.keyboardPanningEnabled = true
        self.inverted = false

我添加了它以使其显示但它没有

        self.leftButton.hidden = false
    }

1 个答案:

答案 0 :(得分:1)

如果您需要显示左键,只需将其初始化即可。

self.leftButton.addTarget(self, action: Selector("cameraPressed"), 
    forControlEvents: UIControlEvents.TouchUpInside)
self.leftButton.setImage(UIImage.init(named:"CameraIcon"), forState: UIControlState.Normal)

然后你可以在camearPressed函数中添加UIPopOverController。 (我更喜欢UIAlertController风格)