Nscollectionview + nsarraycontroller practice

Source: Internet
Author: User

1. Drag nscollectionview and nsarraycontroller to XIB respectively. When nscollectionview is dragged, an nscollectionviewitem and an nsview are automatically generated.

2. Set nsarraycontroller

A) set the class name and key in the attributes tab.

B) On the Bindings tab, set the nsarray attribute (such as filesarray) of the content array bound to the file's owner)

3. Set nscollectionview

A) On the Bindings tab, bind content to nsarraycontroller, and set the controller key to arrangedobjects.

4. Set the view of nscollectionviewitem

A) add an nsimageview and an nstextfield to the nsview added in step 1.

B) bind the value of nsimageview to nscollectionviewitem, and set model Key Path to representedobject. bigimage.

C) bind the value of nstextfield to nscollectionviewitem, and set model Key Path to representedobject. Name.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.