IOS Uicollectionview and UITableView

Source: Internet
Author: User

Common denominator: All need to accept two protocols and execute proxy method different points: Initialization method different UITableView can be initialized with the Alloc method and Uicollectionview must be initialized with the following method

Initialize Waterfall stream

Uicollectionviewflowlayout *flowlayout = [[Uicollectionviewflowlayout alloc] init];

[FlowLayout Setitemsize:cgsizemake (150,120)]; Setting the width and height of each cell display data must be

Flowlayout.sectioninset = Uiedgeinsetsmake (5, 5, 5, 5);

flowlayout.minimuminteritemspacing = 0;

flowlayout.minimumlinespacing = 0;

[FlowLayout Setscrolldirection:uicollectionviewscrolldirectionhorizontal]; Horizontal Slide

[FlowLayout setscrolldirection:uicollectionviewscrolldirectionvertical]; For control of sliding pages

Self.collectionview = [[Uicollectionview alloc]initwithframe:self.view.bounds collectionviewlayout:flowlayout];

[Self.view AddSubview:self.collectionView];

Self.collectionView.backgroundColor = [Uicolor Whitecolor];

[Self.collectionview Registerclass:[mycell class] forcellwithreuseidentifier:@ "Collectioncell"];

[Self.collectionview setdatasource:self];

[Self.collectionview setdelegate:self];

[Self.view AddSubview:self.collectionView];

Uicollectionview himself without cell must customize   and in-(uicollectionviewcell *) CollectionView: (uicollectionview *) CollectionView Cellforitematindexpath: (nsindexpath *) Indexpath when the cell in this method is initialized, the unique identity must be consistent with that tag at initialization time.

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.