Class: UICollectionViewFlowLayout

Inherits:
UICollectionViewLayout show all

Overview

The UICollectionViewFlowLayout class is a concrete layout object that organizes items into a grid with optional header and footer views for each section. The items in the collection view flow from one row or column (depending on the scrolling direction) to the next, with each row comprising as many cells as will fit. Cells can be the same sizes or different sizes.

Instance Attribute Summary (collapse)

Attributes inherited from UICollectionViewLayout

#collectionView

Method Summary

Methods inherited from UICollectionViewLayout

#collectionViewContentSize, #finalLayoutAttributesForDisappearingDecorationElementOfKind:atIndexPath:, #finalLayoutAttributesForDisappearingItemAtIndexPath:, #finalLayoutAttributesForDisappearingSupplementaryElementOfKind:atIndexPath:, #finalizeAnimatedBoundsChange, #finalizeCollectionViewUpdates, #initialLayoutAttributesForAppearingDecorationElementOfKind:atIndexPath:, #initialLayoutAttributesForAppearingItemAtIndexPath:, #initialLayoutAttributesForAppearingSupplementaryElementOfKind:atIndexPath:, #invalidateLayout, layoutAttributesClass, #layoutAttributesForDecorationViewOfKind:atIndexPath:, #layoutAttributesForElementsInRect:, #layoutAttributesForItemAtIndexPath:, #layoutAttributesForSupplementaryViewOfKind:atIndexPath:, #prepareForAnimatedBoundsChange:, #prepareForCollectionViewUpdates:, #prepareLayout, #registerClass:forDecorationViewOfKind:, #registerNib:forDecorationViewOfKind:, #shouldInvalidateLayoutForBoundsChange:, #targetContentOffsetForProposedContentOffset:withScrollingVelocity:

Methods inherited from NSObject

#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version

Constructor Details

This class inherits a constructor from NSObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NSObject

Instance Attribute Details

- (CGSize) footerReferenceSize

The default sizes to use for section footers. If the delegate does not implement the collectionView:layout:referenceSizeForFooterInSection: method, the flow layout object uses the default footer sizes set for this property. During layout, only the size that corresponds to the appropriate scrolling direction is used. For example, for the vertical scrolling direction, the layout object uses the height value specified by this property. (In that instance, the width of the footer would be set to the width of the collection view.) If the size in the appropriate scrolling dimension is 0, no footer is added.The default size values are (0, 0).

Returns:

- (CGSize) headerReferenceSize

The default sizes to use for section headers. If the delegate does not implement the collectionView:layout:referenceSizeForHeaderInSection: method, the flow layout object uses the default header sizes set in this property. During layout, only the size that corresponds to the appropriate scrolling direction is used. For example, for the vertical scrolling direction, the layout object uses the height value returned by your method. (In that instance, the width of the header would be set to the width of the collection view.) If the size in the appropriate scrolling dimension is 0, no header is added.The default size values are (0, 0).

Returns:

- (CGSize) itemSize

The default size to use for cells. If the delegate does not implement the collectionView:layout:sizeForItemAtIndexPath: method, the flow layout uses the value in this property to set the size of each cell. This results in cells that all have the same size.The default size value is (50.0, 50.0).

Returns:

- (Float) minimumInteritemSpacing

The minimum spacing to use between items in the same row. If the delegate object does not implement the collectionView:layout:minimumInteritemSpacingForSectionAtIndex: method, the flow layout uses the value in this property to set the spacing between items in the same line.For a vertically scrolling grid, this value represents the minimum spacing between items in the same row. For a horizontally scrolling grid, this value represents the minimum spacing between items in the same column. This spacing is used to compute how many items can fit in a single line, but after the number of items is determined, the actual spacing may possibly be adjusted upward.The default value of this property is 10.0.

Returns:

- (Float) minimumLineSpacing

The minimum spacing to use between lines of items in the grid. If the delegate object does not implement the collectionView:layout:minimumLineSpacingForSectionAtIndex: method, the flow layout uses the value in this property to set the spacing between lines in a section. For a vertically scrolling grid, this value represents the minimum spacing between successive rows. For a horizontally scrolling grid, this value represents the minimum spacing between successive columns. This spacing is not applied to the space between the header and the first line or between the last line and the footer. The default value of this property is 10.0.

Returns:

- (UICollectionViewScrollDirection) scrollDirection

The scroll direction of the grid. The grid layout scrolls along one axis only, either horizontally or vertically. For the non scrolling axis, the width of the collection view in that dimension serves as starting width of the content. The default value of this property is UICollectionViewScrollDirectionVertical.

Returns:

  • (UICollectionViewScrollDirection)

- (UIEdgeInsets) sectionInset

The margins used to lay out content in a section If the delegate object does not implement the collectionView:layout:insetForSectionAtIndex: method, the flow layout uses the value in this property to set the margins for each section. Section insets reflect the spacing at the outer edges of the section. The margins affect the initial position of the header view, the minimum space on either side of each line of items, and the distance from the last line to the footer view. The margin insets do not affect the size of the header and footer views in the non scrolling direction. The default edge insets are all set to 0.

Returns: