I’d like to have a ‘Detail view’ for when the user double clicks on a row, I’m just not sure how to get the data to the NSViewController, so it can display the content. I’m using CoreData and I can’t think of a way to do this.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are a couple of steps you need to do here:
Make sure the table view is driven by a
NSArrayControllerand that your controller for the table view (either a window controller or a view controller, or whatever) has thatNSArrayControllerbound to an ivar so that you access it.In your table controller set the double click action to a method in your controller and set the target to your controller.
In the double click method you can access the row by requesting the
-selectedObjectsfrom theNSArrayControllerand that resultingNSArrayshould have only one element in it.From there you can then create your detail view or whatever else you want to do with it. You can create a sheet and display it, open a modal window, etc.