Closed lukewcn closed 10 years ago
I guess you can simply instantiate your custom classes, keeping a strong reference to them in your SlackTextViewController subclass, and override the tableview's delegate/datasource.
self.tableView.delegate = myCustomDelegateObject;
self.tableView.dataSource = myCustomDataSourceObject;
Does this make sense?
Did not figure it out, I just not get your meanings. Do you mean, make my custom controller subclass the SlackTextViewController, and keep my tableview and change the delegates?
I mean a tableview created by xib, I found #16 , but seems no good solution for this, did you make any change for #16 ?
Sorry, I'm not really understanding what you are asking... You want to use a custom tableview? or delegate/datasource?
I use storyboard to create tableView, my question is just like the #16
@hit1983 I think what you're asking is how to connect a tableview you've already added to your storyboard via an IBOutlet?
Right now you'll want to let the SlackTextViewController create that for you so it can create it & properly set up the constraints. In order to tell slack what you want you'll use the default table view style. You can override this if needed.
+ (UITableViewStyle)tableViewStyleForCoder:(NSCoder *)decoder
{
return UITableViewStylePlain;
}
From there you'll just override the delegate methods in your custom controller or set the delegate & dataSource to another class. Check out the example project.
You might be asking, 'well how do I have other things in the view beside the table view?' I believe the current intent behind this implementation is to have the entire view own the tableview or collectionview in order to properly handle scrolling & moving the text field.
Well said @mcgraw! Closing this for now.
I already have a table view in the controller, and the controller conforms the UITableViewDelegate and I have another datasource file conforms the UITableViewDataSource, how can i handle this situation?