Cocoa Programming L42 - NSCollectionView

preview_player
Показать описание
How to use NSCollectionView in Cocoa
Рекомендации по теме
Комментарии
Автор

This is really outdated info now. Please check some of my later tutorials for the better APIs.

AppleProgramming
Автор

Dear Lucas,
While following the tutorial was very clear, there was an initial problem: dragging out a Collection View didn’t also add items to the workbench. I manually added a Collection View Item to the bench and a Custom View to the XIB, then followed every step in your tutorial. Upon building and running I got a crash in main.m at the return NSApplication() line with this error:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Failed to auto-identify an item type to instantiate for <NSCollectionView: 0x7fe82b90e610>: Either register exactly one item nib or class with the CollectionView, or implement the dataSource method to instantiate and return items of the correct type(s).'

While it is quite clear that the app is looking for something that I am not providing, I tried to run your source code and it works.
I checked all the code, and it matched the tutorial. The only thing that I found different was an outlet from the Collection View called itemPrototype > Collection View Item. All eager, I went on and connected it, then built and ran the program. The build failed saying:
Illegal Configuration > NSCollectionView Layout mode cannot be used with the “itemPrototype” outlet
Error > NSCollection View Layout mode cannot be used with the “itemPrototype” outlet. [12]

Could you please kindly explain to me what is happening here, why it is not working as your source code is, and what I could do to make it work?
Thank you very much

TheBardsCorner
Автор

I really liked this one (some funny moments too) I'm taking notes during every tutorial because they inspired me to think about more features to add to my app and I can't wait to finish the series and start implementing them! :D

Angel-fuqh
Автор

Hi Lucas, great professional tutorial, many thanks.
Could you please add to your agenda the NSPredicate and how to control display in tableview from outlineview

AMFEG
Автор

Thank you, thank you, thank you :-) I've been struggling with this for a while - all the documentation I've found has left me stumped, but your tutorials are great and now my app is beginning to do what i want it to. All I need to do now is see if I can get the collectionView to work in a Document...

jwhjakd
Автор

There is certainly a fair amount to cover with full screen mode, but if you simply want to enable the full screen option for your window, you can enable this in Interface Builder. Simply select your window, go to its attributes and change fullscreen to primary window.

AppleProgramming
Автор

this was really clear and helpful. thank you.

houstonwegotaprblm
Автор

I am in university currently and still getting settled in and I do apologize for pushing this off (although I'm sure it means little to you). It literally is on my list right behind responder chain, but I'll push it to #1. I never did finish the App Submission series either so that really should have been completed but the next Obj-C tutorial will be on NSPredicate. I'll link it back to sorting in Cocoa as well later.

AppleProgramming
Автор

Ya it's been a while, there will be many more tutorials coming up on app distribution and neat things you can use in Mountain Lion when that comes out.

AppleProgramming
Автор

Did you watch this series from the beginning? Or watch all the Obj-C series also?

AppleProgramming
Автор

The only way  I could get Xcode 6 to see the NSArrayController class was by adding the #import <appkit/appkit.h> after the foundation import otherwise Xcode didn't know what NSArrayController was even though it knew about its definition in the help file.

DrWho
Автор

thank you very much! very clear tutorial

mmejiam
Автор

Hi Lucas, hope you will have time soon for the NSPredicate and how to control display in tableview specially from outlineview, best.

AMFEG
Автор

NSPredicate would be worth while, I should have covered sorting and filtering with the NSTableView. I'll add it to the list.

AppleProgramming
Автор

Lucas,
With Lion, Apple profited a full screen mode like safari has and many more apps. Can you maybe make a tut on how to include that also on your own app?
That would be great!
Thanks,

PieterJacob
Автор

Allrighty! Thanks for the quick response!

PieterJacob
Автор

Hi Lucas, hope things are going well at school.  I know that you still need to do the final two videos on the NSTableView; looking forward to those.  I was wondering if you will have any follow-ups on NSCollectionView.  I think this has a lot of potential, but I am having a time trying to figure out how to select an instance and how to add a button to the repeating collection.  Digging into books now but love the video and generally get a better understanding.

robertfields
Автор

I promise you I'll do this right after I finish my App Submission tutorials (starting this weekend). I know it sucks to wait but I swear I'll run through sorting for you, it's not all that difficult. I'll show you how to sort these object if you want ;)

AppleProgramming
Автор

Lucas, seems repeated question but could you pls clarify how can we sort the array to have the students in alphabetical order and how can we filter the array for the collection view to show students starting with L or N only

AMFEG
Автор

What should I do if I want to add some IBOutlet and IBAction items in each view of collection view item? I mean if I add some IBOutlet and IBAction items in class student, what should I do to make them work on each view I add in collection view item?

ultrasonic
welcome to shbcf.ru