MDCSelfSizingStereoCell


@interface MDCSelfSizingStereoCell : MDCBaseCell

MDCSelfSizingStereoCell is intended to be an easy to use readymade implementation of a basic Stereo cell. A stereo cell can be thought of as a roughly symmetrical cell with image views on either side–like the speakers in an old fashioned boombox stereo.

The cell is intended to be used with a UICollectionViewFlowLayout with an estimatedItemSize. Setting estimatedItemSize on the layout tells the collection view and the layout to query the cell for a size that best fits the estimated size. The cell lays out its contents according to the width provided in the estimated size and then calculates a height based off the layout. For any given width there is only one correct height.

The client is expected to configure the exposed subviews in any way they like from within -collectionView:cellForItemAtIndexPath:. If changes that might have ramifications to the cell’s layout or size are made outside of -collectionView:cellForItemAtIndexPath: a call to -setNeedsLayout is necessary to invalidate previously calculated layouts.

The client is expected NOT to manually set the frames of the view themselves or manipulate the view hierarchy in any way.

  • The UIImageView responsible for displaying the leading image.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic) UIImageView *leadingImageView;
  • The UIImageView responsible for displaying the trailing image.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic) UIImageView *trailingImageView;
  • The UILabel responsible for displaying the title text. By default, numberOfLines is set to 0 so the label wraps and the self-sizing capabilities of the cell are best utilized.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic) UILabel *titleLabel;
  • The UILabel responsible for displaying the detail text. By default, numberOfLines is set to 0 so the label wraps and the self-sizing capabilities of the cell are best utilized.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic) UILabel *detailLabel;
  • Indicates whether the view’s contents should automatically update their font when the device’s UIContentSizeCategory changes. This property is modeled after the adjustsFontForContentSizeCategory property in the UIContentSizeCategoryAdjusting protocol added by Apple in iOS 10.0. Default value is NO.

    Declaration

    Objective-C

    @property (setter=mdc_setAdjustsFontForContentSizeCategory:, assign, readwrite,
              nonatomic) BOOL mdc_adjustsFontForContentSizeCategory;
  • Affects the fallback behavior for when a scaled font is not provided.

    If enabled, the font size will adjust even if a scaled font has not been provided for a given UIFont property on this component.

    If disabled, the font size will only be adjusted if a scaled font has been provided. This behavior most closely matches UIKit’s.

    Default value is YES, but this flag will eventually default to NO and then be deprecated and deleted.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic)
        BOOL adjustsFontForContentSizeCategoryWhenScaledFontIsUnavailable;