One TableView implemented in several ViewControllers - xcode

I am looking for a way to create a TableView to show a list of posts on a social networking site. I want to place the exact same prototype table in several ViewControllers and based on the current ViewController, it will be populated with different information. Is there a way to do this with Storyboard? I assume that this is quite easy using only code, but I would like to drag and drop elements to create the prototype cell.
Thanks

For each view controller you should create a new table view. You could reuse table view cells by creating a custom nib cell and populating each table view accordingly.

This is a good tutorial on how to populate a table view with an rss feed.
https://www.youtube.com/watch?v=NyrGnbzXpxk
You can then find the rss feed of each social media page that you want to include in each table view.

Related

How to create a page that leads to multiple scrollviews in swift

The beginning page is a table view. On the table view there is table that contains four different topics(picture provided). I would like each topic to lead to a new page that is a scroll view. I have successfully programmed so that the first topic will lead to a scroll view. However, I am having trouble creating more than one scroll view page for each topic. enter image description here
How to:
Create destination view controllers in your storyboard.
Create segues by CTRL-dragging from cell to the view controller that should be shown when the cell is tapped.

Cocoa bindings issue with three tableviews

im a osx-dev noob that is trying to build an application with three table views that will show the content of a core data store entity. But each table view is filtered on the attribute "status" of the entity.
the problem occurs when i also want to show the selected entity in textfields. I'm using three different array controllers with different fetch predicates. But in a textfield i can only bind the value to one array controller.
should i ditch the bindings and do it all programaticly or is there a simple solution to this? :)
here is an screenshot so you can grasp my app description.
Keep bindings to populate the text fields if it satisfies what you want to do with this GUI. I'd add an NSObjectController to control the one entity those fields represent. If you want the user's changes to those fields persisted, bindings are still awesome.
But I think with three tables that might control what's displayed in the text fields, you're going to need to have some sort of non-binding glue code that determines which of the tables wins. You can probably do everything you want by implementing some of the NSTableViewDelegate protocol.
If the text fields should display the last entity that the user clicked in any of the tables, simply have each table call the same tableViewSelectionDidChange delegate function. All three tables could have the same delegate. You can then call setContent on the NSObjectController from that function.
You could also use similar glue code to prevent more than one selection in any of the three tables, by having the same delegate function deselect everything in the other tables either through the view or the controller. But that's up to you and needs consideration of whether you want multiple selection, etc.

Connect two NSObjectControllers within a multi view OSX Storyboard

I'm using Storyboards for the first time creating a master/detail view for a simple object.
Both view controller items of the split view have their own view & NSObjectControllers. The controller for the table view is a NSArrayController (which shows all instances of the Entity). The controller for the detail view is an NSObjectController, which shows just the selected instance.
When I click an object in the table, I'd like the detail to show up in the detail view. So I believe my goal here is to bind the 'contents' of the detail object controller to the 'selection' of the master array controller. However with storyboards I cannot cross view controller boundaries (can't create the IB 'link'. aka: can't bind cross VC).
Whats the best practice for doing this?
So far all I can think to do is manually set all this up in one of the controllers (either the root controller, window controller or perhaps the master table view controller) - but that seems counterintuitive. That seems to defeat the purpose of being able to lay out this stuff within storyboards in the first place, and my controller of choice would then have to know about the other controller specifically.
I must be missing something!

Image in a NSPopUpButtonCell with NSArrayController and Core Data

This is the scenario: A Core Data model with an entity which contains a relationship to a second entity. The latter entity contains an attribute which is an image and a second attribute with is a name (NSString).
The GUI is a NSTableView which is bound to a NSArrayController. One column of the table is a NSPopUpButtonCell. It is setup so that it currently contains the names of the second entity. It works well so far.
The problem is that I would like to show the image instead of the name. NSPopUpButtonCell is basically able to show images but I'm not able to setup the proper bindings. Setting the bindings directly in the cell doesn't work and the column binding of the table view doesn't feature an image as binding.
It's a little bit complicated but maybe someone can gibe me a hint!
Thanks in advance,
Thomas

Cocoa: how can I add custom row in table? or other way?

Is it possible to add different rows created in IB? What I mean is:
**All rows should be created not programatically, but with pre-created with objects.
Or maybe is other way to do this?? maybe without table??
No, you can't create a table with pre-existing rows from within IB.
You can however create text and image based table rows in IB, and lay them out, but you then have to write the table delegate code to load these from the xib and add them to the table as an when required.

Resources