slackhq / SlackTextViewController

⛔️**DEPRECATED** ⛔️ A drop-in UIViewController subclass with a growing text input view and other useful messaging features
https://slack.com/
MIT License
8.32k stars 1.08k forks source link

Can I use my UITableView and just display the slacktextviewcontroller inputBar? #250

Closed ghost closed 9 years ago

ghost commented 9 years ago

How can this be done? I have a tablewView that is an outlet and a UIView with a textView as an outlet. I would like to just display the inputbar. I am using Swift. Any help would be appreciated. Thanks!

mixdesign commented 9 years ago

+1

dzenbot commented 9 years ago

The Inputbar is managed by SLKTextViewController so I'm afraid what you are tying to do isn't possible. Why not subclass SLKTextViewController?

ghost commented 9 years ago

@dzenbot thanks for your response. I have subclassed the SLKTextViewController. But then the viewcontroller does not display what I have in the storyboard. I guess the best practice for me is just to write code to configure my viewcontroller? Thanks!

dzenbot commented 9 years ago

There is storyboard compatibility. Please have a look at the sample project.

ghost commented 9 years ago

@dzenbot is the sample project available in Swift?

ghost commented 9 years ago

@dzenbot the storyboard sample is only in Objective-C. :'(

dzenbot commented 9 years ago

There is a Swift sample project, incomplete, in https://github.com/slackhq/SlackTextViewController/tree/swift-example

I'm not yet into Swift that much and was hoping the community could contribute to build a great Swift sample ¯(ツ)

dzenbot commented 9 years ago

Anyway, for storyboard compatibility, you should only care about the following method to override in your subclass:

override class func tableViewStyleForCoder(decoder: NSCoder) -> UITableViewStyle {
        return UITableViewStyle.Plain;
    }
kevinrenskers commented 9 years ago

But this storyboard compatibility.. it's not possible to use your own, existing UITableView, right? For example I have an existing scene in a storyboard. It's a UIViewController with a UITableView. It's connected to the view controller via an outlet. Now I want to make this view controller a SLKTextViewController instead, but it seems that I can't keep on using my existing table (with all its prototype cells etc). It seems that I have to remove the table view from my scene, and use the programmatically created one from SLKTextViewController. Then use individual nibs for the different cells etc, instead of using prototype cells in the storyboard.

dzenbot commented 9 years ago

You cannot use your custom UITableView, no. Everything is setup programatically. The Storyboard compatibility does only work when using with an empty nib extending SLKTextViewController. I'm happy to accept any improvements in this area, that make the Storyboard integration better tho.

dilizarov commented 9 years ago

Would be spectacular if you could just hook in a current UITableView via IBOulets.

dzenbot commented 9 years ago

It would. Can't imagine how it would be compatible tho. I'm open to ideas.