Cocoa: Core Data + NSTableView - cocoa

I have a core data app set up, and everything is working pretty well. But there is one little problem. When I insert a new object into my entity I have it go to my NSTableViewCell, where I can edit it to the text I want, but there's one little issue, I can edit the cell, but I can't deselect it to save it to core data, it's stuck in edit mode and the only way I can get out of it is by quitting the application, AND it doesn't save the new name I just gave it in my cell.

This kind of functionality is covered in the Core Data tutorials provided by Apple. It will get you to make use of the NSArrayController which is a very helpful class for synchronising the view (NSTableView) and the model (Core Data).
I believe this is a great place to see how this works: http://developer.apple.com/cocoa/coredatatutorial/index.html
Hope that helps.

What method are you using to connect the table view to the core data store? Bindings? Data Source?
My guess is that you haven't implemented this at all. If you are just getting starting then I suggest implementing an NSTableViewDataSource instance.
http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSTableDataSource_Protocol/Reference/Reference.html

Related

Downloading Saved Data on the iCloud

I'm new to syncing data from iCloud so I have been using different tutorials to figure out how to upload my Core Data database to the iCloud. To do this I used a GitHub Source Code (https://github.com/mluisbrown/iCloudCoreDataStack). According to the Debug menu on Xcode 5 I am uploading Data to the iCloud and then it shows it is downloading however I see no data being returned, I think this is because I have nothing implemented in the -(void)storesDidChange:(NSNotification *)note method. I have no clue how to put this data into practice. Please let me know if there is anything you need from me and I'll be happy to get it to you! Thank You!
This is a standard Core Data iCloud issue and is not impacted by the code you are using.
You need to consume that notification when it comes back. You do this with your main NSManagedObjectContext using the method -[NSManagedObjectContext mergeChangesFromContextDidSaveNotification:]. This will cause your NSManagedObjectContext to tickle any NSFetchedResultsController instances that you have.
I am also using PersistanceStack. In storesDidChange:, I simply post a notification to the notification center. This is caught by any active view controller displaying any relevant data.
In the view controller I simply update the Interface, e.g. by performing a fetch on the fetched results controller and/or reloading a table view.

View Controller with Multiple sub views

I have a website page which I need to replicate in my app (as a reference for anyone that wants to help the url is http://www.sccgformulary.co.uk/gis.html) There is a title, some sub-headings, plenty of text in different sections and a few different tables. The colouring in the background isn't needed.
My question is how would this be implemented in Interface Builder (if it is even possible?) I don't know how to design the layout of a page which extends further than 1 screen. I've done it before programatically - is this the only way to design views which need a scrollview with multiple subviews? any help would be greatly appreciated!
What you are looking for is probably a simple UITableView with a custom UITableViewCell.
You might need some way of feeding data to your application via a web service. JSON is popular. but before you go ahead I suggest you read up on UITableView and look at some similar Apps to find out exactly what you want.

Which framework to design this web interface?

I would like to create a web page, which documents manually-inputted data about user permissions, that looks like below, which is really pulling data out of a MySQL table.
The way it should act is that whenever someone updates the table to overwrite a value, the old values are stored in a log as a "past revision" -- Which I have no problem on the database side, but I want those past revisions to show up behind the current data on the website, as seen below.
Someone needs to be able to see the current data at a glance, but also the past revisions that expand somehow when clicked. I want this done without having the page refreshed, so maybe jQuery or some active scripting?
That's the heart of the question here, is what technology can easily accomplish the needs of this interface? What do you guys recommend? Examples would be very beneficial. Thanks in advance.
You may try out SVG (along with some jquery for some rich interface):
http://www.w3schools.com/svg/default.asp

Populating a UiWebview control with data from a Kumulos API

I am currently really new to Xcode and the whole Iphone App development but reasonable proficient in Javascript/HTML/SQL.
I am looking at creating a new App which queries its data from a Kumulos database (Kumulos API's).
Before i head down the path, i just want to know if it was possible to query the database(i know how to do this), but more importantly load the returned data into a webview control.
Similar sort of idea as facebook app. I know they use a webview control.
Ive searched, but currently haven't found an answer on how do do this.
Can you suggest a better method?
Excuse my lack of coding examples.
The best way to do this is create objecive-C methods that are called by the javascript in your web view as per this guide:
Calling Objective-C from UIWebView
This way you could call an objective-C function that returns the data loaded from Kumulos, you can then do what you like in the javascript with the loaded data.

displaying web pages over web views in collection view using cocoa bindings

I tried sample example given at this link - Collection View Programming Guide
It is simple and it worked. Considering it as a reference I tried a simple application which will show a collection view of web views with some web page displayed over each web view.
The model class has two properties: NSString *pageName, and NSURL *pageURL.
I then followed each and every step written in tutorial above with required modifications but I was caught in the step -
How to bind web view to collection
view item?
In binding tab it shows three possibilities : Editable, Hidden, Tool tip but none of these is working.
Can anyone suggest me way to accomplish my requirement?
Thanks,
Miraaj
WebView does not expose bindings for the URL (one would think it would, but it doesn't). You'll need to make use of NSCollectionViewItem (create a custom subclass) and update your WebView's URL when its represented object is changed.
The quick start guide you referenced does not show how to use a custom collection view item (it shows a very basic case). You'll need to delve a little deeper into the documentation (and online examples) to achieve your goal.
I would offer one thought to consider regarding your overall goal: WebView is a "heavy" object, so keep your performance expectations realistic regarding creating many of these views.

Resources