Class: UICollectionViewLayoutAttributes

Inherits:
NSObject show all

Overview

An UICollectionViewLayoutAttributes object manages the layout-related attributes for a given item in a collection view. Layout objects create instances of this class when asked to do so by the collection view. In turn, the collection view uses the layout information to position cells and supplementary views inside its bounds.

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

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

- (Float) alpha

The transparency of the item. Possible values are between 0.0 (transparent) and 1.0 (opaque). The default is 1.0.

Returns:

- (CGPoint) center

The center point of the item. The center point is specified in the coordinate system of the collection view. Setting the value of this property also updates the origin of the rectangle in the frame property.

Returns:

  • (CGPoint)

- (CGRect) frame

The frame rectangle of the item. The frame rectangle is measured in points and specified in the coordinate system of the collection view. Setting the value of this property also sets the values of the center and size properties.

Returns:

- (Boolean) hidden

Determines whether the item is currently displayed. The default value of this property is NO. As an optimization, the collection view might not create the corresponding view if this property is set to YES.

Returns:

  • (Boolean)

- (NSIndexPath) indexPath

The index path of the item in the collection view. The index path contains the index of the section and the index of the item within that section. These two values uniquely identify the position of the corresponding item in the collection view.

Returns:

- (UICollectionElementCategory) representedElementCategory (readonly)

The type of the item. (read-only) You can use the value in this property to distinguish whether the layout attributes are intended for a cell, supplementary view, or decoration view.

- (String) representedElementKind (readonly)

The layout-specific identifier for the target view. (read-only) You can use the value in this property to identify the specific purpose of the supplementary or decoration view associated with the attributes. This property is nil if the representedElementCategory property contains the value UICollectionElementCategoryCell.

Returns:

- (CGSize) size

The size of the item. Setting the value of this property also changes the size of the rectangle returned by the frame property.

Returns:

- (CATransform3D) transform3D

The transform of the item. Setting the value of this property affects the rectangle returned by the frame property.

Returns:

  • (CATransform3D)

- (Integer) zIndex

Specifies the item’s position on the z axis. The default value of this property is 0.

Returns:

Class Method Details

+ (instancetype) layoutAttributesForCellWithIndexPath(indexPath)

Creates and returns a layout attributes object that represents a cell with the specified index path. Use this method to create a layout attributes object for a cell in the collection view. Cells are the main type of view presented by a collection view. The index path for a cell typically includes both a section index and an item index for locating the cell’s contents in the collection view’s data source.

Parameters:

  • indexPath (NSIndexPath)

    The index path of the cell.

Returns:

  • (instancetype)

    A new layout attributes object whose precise type matches the type of the class used to call this method.

+ (instancetype) layoutAttributesForDecorationViewOfKind(decorationViewKind, withIndexPath:indexPath)

Creates and returns a layout attributes object that represents the specified decoration view. Use this method to create a layout attributes object for a decoration view in the collection view. Decoration views are a type of supplementary view but do not present data that is managed by the collection view’s data source. Instead, they mostly present visual adornments for a section or for the entire collection view. It is up to you to decide how to use the indexPath parameter to identify a given decoration view. Typically, you use the decorationViewKind parameter to identify the type of the decoration view and the indexPath information to distinguish between different instances of that view.

Parameters:

  • decorationViewKind (String)

    The kind identifier for the specified decoration view.

  • indexPath (NSIndexPath)

    An index path related to the decoration view.

Returns:

  • (instancetype)

    A new layout attributes object whose precise type matches the type of the class used to call this method.

+ (instancetype) layoutAttributesForSupplementaryViewOfKind(elementKind, withIndexPath:indexPath)

Creates and returns a layout attributes object that represents the specified supplementary view. Use this method to create a layout attributes object for a supplementary view in the collection view. Like cells, supplementary views present data that is managed by the collection view’s data source. But unlike cells, supplementary views are typically designed for a special purpose. For example, header and footer views are laid out differently than cells and can be provided for individual sections or for the collection view as a whole.It is up to you to decide how to use the indexPath parameter to identify a given supplementary view. Typically, you use the elementKind parameter to identify the type of the supplementary view and the indexPath information to distinguish between different instances of that view.

Parameters:

  • elementKind (String)

    A string that identifies the type of supplementary view.

  • indexPath (NSIndexPath)

    The index path of the view.

Returns:

  • (instancetype)

    A new layout attributes object whose precise type matches the type of the class used to call this method.