IOS Uicollectionview XIB

Source: Internet
Author: User

Copyright NOTICE: This article is the original article, without the owner's permission to reprint.

Directory (?) [+]

First, meet Uicollectionview . [OBJC] view plain copy Ns_class_available_ios (6_0) @interface Uicollectionview:uiscrollview


The Uicollectionview and Uicollectionviewcontroller classes are iOS6 newly introduced APIs for displaying collection views, more flexible layouts, and multiple-column layouts, similar to UITableView and Uitableviewcontroller class.

Using Uicollectionview must implement Uicollectionviewdatasource,uicollectionviewdelegate, Uicollectionviewdelegateflowlayout these three agreements.


here are some common methods, specific use can refer to Demo: point I download the Apple official demo: Click I download [OBJC]  View Plain  copy  -  (void) viewdidload   {       [super  viewDidLoad];       self.title = @ "Uicollectionview learning";               //generates a cell via nib, then registers  nib view needs to inherit   uicollectionviewcell       [self.collectionView registerNib:[UINib  nibwithnibname:@ "Sqcollectioncell"  bundle:nil] forCellWithReuseIdentifier:kcellIdentifier];               //Registration headerview  NIB's view needs to inherit uicollectionreusableview       [self.collectionview registernib: [uinib nibwithnibname:@ "Sqsupplementaryview"  bundle:nil] forsupplementaryviewofkind: uicollectionelementkindsectionheader withreuseidentifier:kheaderidentifier];        //registered Footerview nib's view needs to inherit Uicollectionreusableview       [self.collectionView registerNib:[UINib  nibwithnibname:@ "Sqsupplementaryview"  bundle:nil] forsupplementaryviewofkind: uicollectionelementkindsectionfooter withreuseidentifier:kfooteridentifier];        //       self.collectionview.allowsmultipleselection = yes ;//default is no, can I select multiple          }     -  (void) didreceivememorywarning   {       [super didReceiveMemoryWarning];        // dispose of any resources that can be  recreated.  }   #pragma  mark -CollectionView datasource  // section  -  (Nsinteger) Numberofsectionsincollectionview: (uicollectionview *) CollectionView    {     &Nbsp; return 2;  }  //item number   -  (Nsinteger) CollectionView: ( uicollectionview *) Collectionview numberofitemsinsection: (Nsinteger) section   {       return 6;         }  

Related Article

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.