iOS Development--ui OC Chapter &uicollectionview + Examples

Source: Internet
Author: User
<span id="Label3"></p>Uicollectionview + Examples<p><p></p></p><p><p>Implementation Steps:</p></p><p><p>first, the new two classes</p></p> <ul> <ul> <li>1. Subclasses that inherit from uiscrollview, such as Hmwaterflowview</li> <li>* Waterfall Flow display control, used to display all waterfall stream data</li> <li></li> <li>2. Subclasses that inherit from uiview, such as Hmwaterflowviewcell</li> <li>* Represents a unit in the waterfall stream data (a Lattice)</li> <li></li> <li>3. Summary</li> <li>The relationship between Hmwaterflowview and Hmwaterflowviewcell is actually similar to</li> <li>The relationship between UITableView and UITableViewCell</li> </ul> </ul><p><p><br>second, The design Hmwaterflowview interface</p></p> <ul> <ul> <li>1. Imitate the UITableView interface to design</li> <li>* Design a set of data sources and proxy methods</li> </ul> </ul><p><p><br>third, the realization of Hmwaterflowview</p></p> <ul> <ul> <li>1.reloadData</li> <li>* Function: Refresh Data</li> <li>Steps</li> <li>1> empty the previously remaining data</li> <li>2> calculates the frame that corresponds to all new data</li> <li></li> <li>2.layoutSubviews</li> <li>* Role: display and remove child controls</li> <li>Steps</li> <li>1> detects that each data frame is not on the screen (the user can see It)</li> <li>2> If this data corresponds to a frame on the screen: request the cell corresponding to the data source, add this cell to Hmwaterflowview display</li> <li>3> if the frame for this data is not on the screen: remove the cell corresponding to the data from the Hmwaterflowview and add the cell to the cache pool</li> </ul> </ul><p><p><strong>This chapter first introduces Uicollectionview and its common methods, and then combines an example to learn how to use UICOLLECTIONVIEW.</strong></p></p><p><p></p></p><p><p>The Uicollectionview and Uicollectionviewcontroller classes are IOS6 's newly introduced APIs for presenting collection views, with a more flexible layout that enables multi-column layouts, similar to UITableView and Uitableviewcontroller class.</p></p><p><p>Using Uicollectionview must implement uicollectionviewdatasource,uicollectionviewdelegate, Uicollectionviewdelegateflowlayout these three agreements.</p></p><p><p></p></p><p><p><strong>here are some commonly used METHODS. (only common, Others can see the relevant api)</strong> <span style="line-height: 1.5;"> </span></p></p><pre><span style="color: #008080;"><span style="color: #008080;">1</span></span> <span style="color: #0000ff;"><span style="color: #0000ff;">#pragma</span></span>Mark--uicollectionviewdatasource<span style="color: #008080;"><span style="color: #008080;">2</span></span> <span style="color: #008080;"><span style="color: #008080;">3</span></span> <span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">defines the number of Uicollectionviewcell to show</span></span><span style="color: #008080;"><span style="color: #008080;">4</span></span>-(nsinteger) Collectionview: (uicollectionview *<span style="color: #000000;"><span style="color: #000000;">) CollectionView numberofitemsinsection: (nsinteger)</span> section</span><span style="color: #008080;"><span style="color: #008080;">5</span></span> <span style="color: #000000;"><span style="color: #000000;"> { </span></span><span style="color: #008080;"><span style="color: #008080;">6</span></span> <span style="color: #0000ff;"><span style="color: #0000ff;">return</span></span> <span style="color: #800080;"><span style="color: #800080;"></span> -</span><span style="color: #000000;"><span style="color: #000000;">; </span></span><span style="color: #008080;"><span style="color: #008080;">7</span></span> <span style="color: #000000;"><span style="color: #000000;"> } </span></span><span style="color: #008080;"><span style="color: #008080;">8</span></span> <span style="color: #008080;"><span style="color: #008080;">9</span></span> <span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">define the number of sections to show</span></span><span style="color: #008080;"><span style="color: #008080;">Ten</span></span>-(nsinteger) Numberofsectionsincollectionview: (uicollectionview *<span style="color: #000000;"><span style="color: #000000;">) CollectionView</span></span><span style="color: #008080;"><span style="color: #008080;"></span> one</span> <span style="color: #000000;"><span style="color: #000000;"> { </span></span><span style="color: #008080;"><span style="color: #008080;"></span> a</span> <span style="color: #0000ff;"><span style="color: #0000ff;">return</span></span> <span style="color: #800080;"><span style="color: #800080;">1</span></span><span style="color: #000000;"><span style="color: #000000;">; </span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #000000;"><span style="color: #000000;"> } </span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #008080;"><span style="color: #008080;"></span> the</span> <span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">what each Uicollectionview shows</span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span>-(uicollectionviewcell *) collectionview: (uicollectionview *) collectionview cellforitematindexpath: (NSIndexPath *<span style="color: #000000;"><span style="color: #000000;">) Indexpath</span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #000000;"><span style="color: #000000;"> { </span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #0000ff;"><span style="color: #0000ff;">Static</span></span>NSString * Cellidentifier =<span style="color: #800000;"><span style="color: #800000;">@"</span></span><span style="color: #800000;"><span style="color: #800000;">Gradientcell</span></span><span style="color: #800000;"><span style="color: #800000;">"</span></span><span style="color: #000000;"><span style="color: #000000;">; </span></span><span style="color: #008080;"><span style="color: #008080;"></span> +</span>Uicollectionviewcell * cell =<span style="color: #000000;"><span style="color: #000000;">[collectionview Dequeuereusablecellwithreuseidentifier:cellidentifier forindexpath:indexpath]; </span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #008080;"><span style="color: #008080;"></span> +</span>Cell.backgroundcolor = [uicolor colorwithred: ((<span style="color: #800080;"><span style="color: #800080;">Ten</span></span>* indexpath.row)/<span style="color: #800080;"><span style="color: #800080;">255.0</span></span>) Green: ((<span style="color: #800080;"><span style="color: #800080;"></span> -</span>* indexpath.row)/<span style="color: #800080;"><span style="color: #800080;">255.0</span></span>) Blue: ((<span style="color: #800080;"><span style="color: #800080;"></span> -</span>* indexpath.row)/<span style="color: #800080;"><span style="color: #800080;">255.0</span></span>) Alpha:<span style="color: #800080;"><span style="color: #800080;">1.0f</span></span><span style="color: #000000;"><span style="color: #000000;">]; </span></span><span style="color: #008080;"><span style="color: #008080;"></span> a</span> <span style="color: #0000ff;"><span style="color: #0000ff;">return</span></span><span style="color: #000000;"><span style="color: #000000;">cell; </span></span><span style="color: #008080;"><span style="color: #008080;"></span> at</span> <span style="color: #000000;"><span style="color: #000000;"> } </span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #0000ff;"><span style="color: #0000ff;">#pragma</span></span>Mark--uicollectionviewdelegateflowlayout<span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">define the size of each Uicollectionview</span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span>-(cgsize) collectionview: (uicollectionview *) collectionview layout: (uicollectionviewlayout*) collectionviewlayout Sizeforitematindexpath: (nsindexpath *<span style="color: #000000;"><span style="color: #000000;">) Indexpath</span></span><span style="color: #008080;"><span style="color: #008080;"></span> in</span> <span style="color: #000000;"><span style="color: #000000;"> { </span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #0000ff;"><span style="color: #0000ff;">return</span></span>Cgsizemake (<span style="color: #800080;"><span style="color: #800080;"></span> the</span>,<span style="color: #800080;"><span style="color: #800080;"></span> -</span><span style="color: #000000;"><span style="color: #000000;">); </span></span><span style="color: #008080;"><span style="color: #008080;"></span> to</span> <span style="color: #000000;"><span style="color: #000000;"> } </span></span><span style="color: #008080;"><span style="color: #008080;"></span> +</span> <span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">define margin for each Uicollectionview</span></span><span style="color: #008080;"><span style="color: #008080;"></span> the</span>-(uiedgeinsets) collectionview: (uicollectionview *) collectionview layout: (uicollectionviewlayout *<span style="color: #000000;"><span style="color: #000000;">) collectionviewlayout insetforsectionatindex: (nsinteger)</span> section</span><span style="color: #008080;"><span style="color: #008080;"></span> *</span> <span style="color: #000000;"><span style="color: #000000;"> { </span></span><span style="color: #008080;"><span style="color: #008080;"></span> $</span> <span style="color: #0000ff;"><span style="color: #0000ff;">return</span></span>Uiedgeinsetsmake (<span style="color: #800080;"><span style="color: #800080;">5</span></span>,<span style="color: #800080;"><span style="color: #800080;">5</span></span>,<span style="color: #800080;"><span style="color: #800080;">5</span></span>,<span style="color: #800080;"><span style="color: #800080;">5</span></span><span style="color: #000000;"><span style="color: #000000;">); </span></span><span style="color: #008080;"><span style="color: #008080;">Panax Notoginseng</span></span> <span style="color: #000000;"><span style="color: #000000;"> } </span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #008080;"><span style="color: #008080;"></span> the</span> <span style="color: #0000ff;"><span style="color: #0000ff;">#pragma</span></span>Mark--uicollectionviewdelegate<span style="color: #008080;"><span style="color: #008080;"></span> +</span> <span style="color: #008080;"><span style="color: #008080;"></span> a</span> <span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">method to invoke when Uicollectionview is selected</span></span><span style="color: #008080;"><span style="color: #008080;"></span> the</span>-(<span style="color: #0000ff;"><span style="color: #0000ff;">void</span></span>) collectionview: (uicollectionview *) collectionview didselectitematindexpath: (nsindexpath *<span style="color: #000000;"><span style="color: #000000;">) Indexpath</span></span><span style="color: #008080;"><span style="color: #008080;"></span> +</span> <span style="color: #000000;"><span style="color: #000000;"> { </span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span>Uicollectionviewcell * cell = (uicollectionviewcell *<span style="color: #000000;"><span style="color: #000000;">) [collectionview cellforitematindexpath:indexpath]; </span></span><span style="color: #008080;"><span style="color: #008080;"></span> $</span>Cell.backgroundcolor =<span style="color: #000000;"><span style="color: #000000;">[uicolor whitecolor]; </span></span><span style="color: #008080;"><span style="color: #008080;"></span> $</span> <span style="color: #000000;"><span style="color: #000000;"> } </span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">returns whether this Uicollectionview can be selected</span></span><span style="color: #008080;"><span style="color: #008080;"></span> the</span>-(BOOL) collectionview: (uicollectionview *) collectionview shouldselectitematindexpath: (nsindexpath *<span style="color: #000000;"><span style="color: #000000;">) Indexpath</span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #000000;"><span style="color: #000000;"> { </span></span><span style="color: #008080;"><span style="color: #008080;">Wuyi</span></span> <span style="color: #0000ff;"><span style="color: #0000ff;">return</span></span><span style="color: #000000;"><span style="color: #000000;">YES; </span></span><span style="color: #008080;"><span style="color: #008080;"></span> the</span> <span style="color: #000000;"><span style="color: #000000;"> } </span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #008080;"><span style="color: #008080;"></span> wu</span> </pre><p><p></p></p><br class="preprocessor"><p><p></p></p><p><p></p></p><p><p><strong>The following is a concrete example of This. (examples come from the Web.) however, it is obtained through a third party and cannot be linked. Also Hope forgive Me. )</strong></p></p><p><p></p></p><p><p>The advent of IOS CollectionView is a great benefit, no longer using TableView to define complex multi-column tables, similar to table, except that the cell must be added by itself, with no default mode</p></p><p><p>Since the CollectionView does not have a default cell layout, it is generally easy and fast to customize</p></p><p><p>one, Custom Cell</p></p><p><p>1, new class Collectioncell inherit from Uicollectionviewcell</p></p><p><p></p></p><p><p>2, New xib, named Collectioncell.xib</p></p><p><p></p></p><p><p>A. Select Collectioncell.xib to delete the default view, drag a collection view Cell from the control (figure 3) to the canvas, and set the size to 95*116;</p></p><p><p></p></p><p><p>B. Select the cell that you just added, change the class name to collectioncell,4</p></p><p><p></p></p><p><p>C. Add a ImageView and a label to the Collectioncell of Collectioncell.xib (figure 5)</p></p><p><p></p></p><p><p>D. Creating a map, figure 6, Figure 7</p></p><p><p></p></p><p><p></p></p><p><p>E. Select collectioncell.m, overriding the init <span style="line-height: 1.5;"></span> method</p></p><pre><span style="color: #008080;"><span style="color: #008080;">1</span></span>- (<span style="color: #0000ff;"><span style="color: #0000ff;">ID</span></span><span style="color: #000000;"><span style="color: #000000;">) initwithframe: (cgrect) frame</span></span><span style="color: #008080;"><span style="color: #008080;">2</span></span> <span style="color: #000000;"><span style="color: #000000;"> { </span></span><span style="color: #008080;"><span style="color: #008080;">3</span></span>Self =<span style="color: #000000;"><span style="color: #000000;">[super initwithframe:frame]; </span></span><span style="color: #008080;"><span style="color: #008080;">4</span></span> <span style="color: #0000ff;"><span style="color: #0000ff;">if</span></span><span style="color: #000000;"><span style="color: #000000;">(self)</span></span><span style="color: #008080;"><span style="color: #008080;">5</span></span> <span style="color: #000000;"><span style="color: #000000;"> { </span></span><span style="color: #008080;"><span style="color: #008080;">6</span></span> <span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">load Collectioncell.xib file when initializing</span></span><span style="color: #008080;"><span style="color: #008080;">7</span></span>Nsarray *arrayofviews = [[nsbundle mainbundle] loadnibnamed:<span style="color: #800000;"><span style="color: #800000;">@"</span></span><span style="color: #800000;"><span style="color: #800000;">Collectioncell</span></span><span style="color: #800000;"><span style="color: #800000;">"</span></span><span style="color: #000000;"><span style="color: #000000;">owner:self options:nil]; </span></span><span style="color: #008080;"><span style="color: #008080;">8</span></span> <span style="color: #008080;"><span style="color: #008080;">9</span></span> <span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">if the path does not exist, return nil</span></span><span style="color: #008080;"><span style="color: #008080;">Ten</span></span> <span style="color: #0000ff;"><span style="color: #0000ff;">if</span></span>(arrayofviews.count <<span style="color: #800080;"><span style="color: #800080;">1</span></span><span style="color: #000000;"><span style="color: #000000;">) </span></span><span style="color: #008080;"><span style="color: #008080;"></span> one</span> <span style="color: #000000;"><span style="color: #000000;"> { </span></span><span style="color: #008080;"><span style="color: #008080;"></span> a</span> <span style="color: #0000ff;"><span style="color: #0000ff;">return</span></span><span style="color: #000000;"><span style="color: #000000;">nil; </span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #000000;"><span style="color: #000000;"> } </span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">If the Xib view does not belong to the Uicollectionviewcell class, return nil</span></span><span style="color: #008080;"><span style="color: #008080;"></span> the</span> <span style="color: #0000ff;"><span style="color: #0000ff;">if</span></span>(! [[arrayofviews objectatindex:<span style="color: #800080;"><span style="color: #800080;">0</span></span>] Iskindofclass:[uicollectionviewcell<span style="color: #0000ff;"><span style="color: #0000ff;">class</span></span><span style="color: #000000;"><span style="color: #000000;">]]) </span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #000000;"><span style="color: #000000;"> { </span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #0000ff;"><span style="color: #0000ff;">return</span></span><span style="color: #000000;"><span style="color: #000000;">nil; </span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #000000;"><span style="color: #000000;"> } </span></span><span style="color: #008080;"><span style="color: #008080;"></span> +</span> <span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">Load NIB</span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span>Self = [arrayofviews objectatindex:<span style="color: #800080;"><span style="color: #800080;">0</span></span><span style="color: #000000;"><span style="color: #000000;">]; </span></span><span style="color: #008080;"><span style="color: #008080;"></span> +</span> <span style="color: #000000;"><span style="color: #000000;"> } </span></span><span style="color: #008080;"><span style="color: #008080;"></span> a</span> <span style="color: #0000ff;"><span style="color: #0000ff;">return</span></span><span style="color: #000000;">self <span style="color: #000000;">; </span></span><span style="color: #008080;"><span style="color: #008080;"></span> at</span>}</pre><p><p></p></p><p><p><br class="alt">F. Select Collectioncell.xib to modify its identifier to Collectioncell.</p></p><p><p><br>second, the definition of uicollectionview;</p></p><p><p>1. Drag a collection view to the specified Viewcontroller view</p></p><p><p>2. Connect datasource and delegate, and create a map named CollectionView</p></p><p><p>3. Select the CollectionView ruler to change the width and height of the cell size to the same 95*116 as the custom cell, Figure 8</p></p><p><p></p></p><p><p>4. Check the properties of collectionview, you can modify its properties, such as vertical sliding, or horizontal sliding, select vertical or Horizontal</p></p><p><p>5, Select collectionviewcell, Modify class, inherit from Collectioncell</p></p><p><p></p></p><p><p>5, in the Viewdidload method declaration cell class, added in the Viewdidload method, this sentence does not declare, will not load, program crashes</p></p><p><p>Where Collectioncell is the identity of the cell (the previous steps have already been defined.) ) <span style="line-height: 1.5;"><br></span></p></p><p><p><span style="line-height: 1.5;"><span class="cnblogs_code"> <span style="color: #008080;">1</span> [self.collectionview Registerclass:[collectioncell <span style="color: #0000ff;">class</span>] Forcellwithreuseidentifier:<span style="color: #800000;">@ "</span><span style="color: #800000;">Collectioncell</span><span style="color: #800000;">"</span>];</span></span></p></p><p><p><br>6. Declare the agent <span style="line-height: 1.5;"></span> in ViewController.h</p></p> <ol class="dp-cpp" start="1"> <ol class="dp-cpp" start="1"> <li class="alt">@interface viewcontroller:uiviewcontroller<uicollectionviewdatasource,uicollectionviewdelegate></li> </ol> </ol><p><p><br><br></p></p><p><p></p></p><p><p>7. Implementing proxy methods <span style="line-height: 1.5;"></span> in. m files</p></p><pre><span style="color: #008080;"><span style="color: #008080;">1</span></span> <span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">Item count for each</span> section</span><span style="color: #008080;"><span style="color: #008080;">2</span></span>-(nsinteger) Collectionview: (uicollectionview *<span style="color: #000000;"><span style="color: #000000;">) CollectionView numberofitemsinsection: (nsinteger)</span> section</span><span style="color: #008080;"><span style="color: #008080;">3</span></span> <span style="color: #000000;"><span style="color: #000000;"> { </span></span><span style="color: #008080;"><span style="color: #008080;">4</span></span> <span style="color: #0000ff;"><span style="color: #0000ff;">return</span></span> <span style="color: #800080;"><span style="color: #800080;"></span> a</span><span style="color: #000000;"><span style="color: #000000;">; </span></span><span style="color: #008080;"><span style="color: #008080;">5</span></span> <span style="color: #000000;"><span style="color: #000000;"> } </span></span><span style="color: #008080;"><span style="color: #008080;">6</span></span> <span style="color: #008080;"><span style="color: #008080;">7</span></span>-(uicollectionviewcell *) collectionview: (uicollectionview *) collectionview cellforitematindexpath: (NSIndexPath *<span style="color: #000000;"><span style="color: #000000;">) Indexpath</span></span><span style="color: #008080;"><span style="color: #008080;">8</span></span> <span style="color: #000000;"><span style="color: #000000;"> { </span></span><span style="color: #008080;"><span style="color: #008080;">9</span></span> <span style="color: #008080;"><span style="color: #008080;">Ten</span></span>Collectioncell *cell = (collectioncell *) [collectionview dequeuereusablecellwithreuseidentifier:<span style="color: #800000;"><span style="color: #800000;">@"</span></span><span style="color: #800000;"><span style="color: #800000;">Collectioncell</span></span><span style="color: #800000;"><span style="color: #800000;">"</span></span><span style="color: #000000;"><span style="color: #000000;">forindexpath:indexpath]; </span></span><span style="color: #008080;"><span style="color: #008080;"></span> one</span> <span style="color: #008080;"><span style="color: #008080;"></span> a</span> <span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">Picture name</span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span>NSString *imagetoload = [nsstring stringwithformat:<span style="color: #800000;"><span style="color: #800000;">@"</span></span><span style="color: #800000;"><span style="color: #800000;">%d.png</span></span><span style="color: #800000;"><span style="color: #800000;">"</span></span><span style="color: #000000;"><span style="color: #000000;">, indexpath.row]; </span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">Loading Pictures</span></span><span style="color: #008080;"><span style="color: #008080;"></span> the</span>Cell.imageView.image =<span style="color: #000000;"><span style="color: #000000;">[UIImage imagenamed:imagetoload]; </span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">Set Label text</span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span>Cell.label.text = [nsstring stringwithformat:<span style="color: #800000;"><span style="color: #800000;">@"</span></span><span style="color: #800000;"><span style="color: #800000;">{%ld,%ld}</span></span><span style="color: #800000;"><span style="color: #800000;">"</span></span>,(<span style="color: #0000ff;"><span style="color: #0000ff;">Long</span></span>) indexpath.row, (<span style="color: #0000ff;"><span style="color: #0000ff;">Long</span></span><span style="color: #000000;"><span style="color: #000000;">) indexpath.section]; </span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span> <span style="color: #008080;"><span style="color: #008080;"></span> +</span> <span style="color: #0000ff;"><span style="color: #0000ff;">return</span></span><span style="color: #000000;"><span style="color: #000000;">cell; </span></span><span style="color: #008080;"><span style="color: #008080;"></span> -</span>}</pre><p><p></p></p><br class="comment"><p><p></p></p><p><p></p></p><p><p>8. Effect 10</p></p><p><p></p></p><p><p>Click on an item after the jump event similar to uitableview, implement proxy method <span style="line-height: 1.5;"><br></span></p></p><p><p><span style="line-height: 1.5;"><span class="cnblogs_code"> <span style="color: #008080;">1</span> -(<span style="color: #0000ff;">void</span>) collectionview: (uicollectionview *) CollectionView didselectitematindexpath: ( Nsindexpath *) Indexpath</span></span></p></p><p><p>Can not repeat the</p></p><p><p>iOS Development--ui OC Chapter &uicollectionview + Examples</p></p></span>

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.