sqlite - Binding List to a NSArrayController to use in an NSTableView -
i trying create simple window display list of items comes sqlite3 database. have generic list of objects, , want bind controls on windows. best way this?
if .net windows forms, this, cocco equivalent? mybindingsource.datasource = new list<myobject>();
my viewcontroller.cs code looks this:
list<myobject> datasource = datastore.getlibraries(); public override awakefromnib() { base.awakefromnib(); datasource = getmyobjects(); myarraycontroller.bind("contentarray", this, "datasource", null); // throws error }
but throws error: class not key value coding-compliant key datasource.
thanks!
after linking libsqlite3.dylib framework (general:linked frameworks , libraries) , adding database-file project create sqlite accessor class, database connections , enable queries.
if project should save database, on installation database must placed @ position have write-access, in "documents"-folder iphone app or in "application support" on macos x, not in application bundle itself. (take care not mess owner-name, otherwise root or have write access , customers won't)
to connect query result array-controller seems heart of question, query's output needs formatted according apple's kvc rules. done creating nsdictionary (with objects , keys) , set array controller read in dictionary.
the link got work in own projects has unfortunately been deleted, found 2 tutorials, give necessary function-calls, if feel need more details on this: a) sqlite connection: http://www.techotopia.com/index.php/an_example_sqlite_based_ios_4_iphone_application_(xcode_4) b) connecting nsarraycontroller dictionary: http://ihoneylocust.wordpress.com/2013/02/19/first-mac/
Comments
Post a Comment