Uicollectionviewcontroller Collection View Controller

Source: Internet
Author: User
Overview: Uicollectionviewcontroller Similar to Uitableviewcontroller is the integration package for Uicollectionview and controller classes. Its role is mainly reflected in Uicollocationview
Uicollectionviewcontroller Basic Properties
-(Instancetype) Initwithcollectionviewlayout: (uicollectionviewlayout *) layout
@property (nonatomic, retain) Uicollectionview *collectionview
@property (nonatomic, readonly) uicollectionviewlayout *collectionviewlayout
@property (nonatomic) BOOL clearsselectiononviewwillappear
@property (nonatomic, assign) BOOL uselayouttolayoutnavigationtransitions

Uicollectionview:It's a new way of displaying data, and in short, it can be understood as a uitableview of multiple columns. Uicollectionview Overview: Standard Uicollectionview contains three parts, they are UIView subclasses: Cells for the main body of the content, for different cell can specify different sizes and different content, this later Supplementary views Append view if you are familiar with UITableView, you can understand the header or footer of each section to mark each section's View decoration comments Decorate view this is the background of each section, such as the bookshelf in ibooks is this----no matter how the layout of a uicollectionview changes, these three parts are present.
About Uicollectionview implementation:     Implementing a Uicollectionview and implementing a uitableview basically no big difference .      They are all the same datasource and delegate design Patterns: DataSource provides resources for view, tells the view what to show and how to display them, delegate provides some small details of the style and the response of the user interaction.     also has three protocol methods that must be implemented: the presentation of two view subclasses (Cells/supplementary views) through the Protocol method.     It should be noted that for decoration views, the provider method is not in Uicontrollerviewdatasource, but directly in the Uicollectionviewlayout class ( Because it is related only to the view and not to the data.     also has a reuse mechanism. But note that in Uicollectionview, not only the cell can be reused, Supplement view and decoration view can and should be reused .  about Uicollectionview agents: &N Bsp   Uicollectionviewdelegate:view profile, user interaction, etc. by the uicollectionviewdelegate to be responsible for, and the provision of data is uicollectionviewdatasource responsible. About cell:      relative to UITableViewCell, Uicollectionviewcell is relatively simple, mainly because of the nature of the display object, Because the Uicollectionview show more flexible objects, so the demand is also strange. So the default Uicollectionviewcell provided to us in the SDK are structurally simple, from top to bottom:  cell itself view/backgroundview/selectedbackgroundview/ Contentview. Uicollectionviewlayout: The essence of     Uicollectionview. You canBy implementing a custom layout for a cell by its subclasses, this is the biggest difference between Uicollectionview and UITableView. Uicollectionviewlayout can say when Uicollectionview's brain and center, which is responsible for the cell supplementary View and decoration views to organize, for them to set their own attributes, Include but not limited to: position/size/transparency/hierarchy/shape/etc. ....     Apple provides us with a minimalist and most commonly used default layout object, Uicollectionviewflowlayout. Flow Layout simply means a straight line to its Layout. By subclasses of this subclass, most of the waterfall stream classes can be implemented simply. Summary:     In general, a Uicollectionview implementation must contain two necessary parts: Uicollectionviewdatasource and Uicollectionviewlayout provides the view content and the location of the view displayed separately. and an interactive part:  uicollectionviewdelegate. The uicollectionviewflowlayout that Apple has given is already a powerful layout. But it's just not enough. The strength of Uicollectionview lies in the custom implementations of various layout, and the switching between them.  
1. Uicollectionview 1.1 Basic Properties/Methods
@property (nonatomic,   assign)   ID <   UICOLLECTIONVIEWDELEGATE&N Bsp >   Delegate @property (nonatomic,   assign)   ID <   uicollectionviewdatasource  > & nbsp DataSource proxy @property (nonatomic,   retain)   uiview  * backgroundview background view
-(void) RegisterClass: (Class) Viewclass
Forsupplementaryviewofkind: (nsstring *) ele Mentkind   withreuseidentifier: (nsstring *) identifier-(ID) dequeuereusablecellwithreuseidentifier : (nsstring *) identifier                                   forindexpath: (nsindexpath *) Indexpath reuse method
@property (nonatomic,   retain

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.