HUBComponentWithImageHandling

@protocol HUBComponentWithImageHandling <HUBComponent>

Extended Hub component protocol that adds the ability to handle images

Use this protocol if your component will display images, either for itself or for any child components that it could potentially be managing. See HUBComponent for more info.

  • Return the size that the component prefers that a certain image gets once loaded

    Declaration

    Objective-C

    - (CGSize)preferredSizeForImageFromData:
                  (nonnull id<HUBComponentImageData>)imageData
                                      model:(nonnull id<HUBComponentModel>)model
                          containerViewSize:(CGSize)containerViewSize;

    Parameters

    imageData

    The data that will be used to load the image

    model

    The current model for the component

    containerViewSize

    The size of the container in which the view will be displayed

  • Update the view to display an image that was loaded

    Declaration

    Objective-C

    - (void)updateViewForLoadedImage:(nonnull UIImage *)image
                            fromData:(nonnull id<HUBComponentImageData>)imageData
                               model:(nonnull id<HUBComponentModel>)model
                            animated:(BOOL)animated;

    Parameters

    image

    The image that was loaded

    imageData

    The data that was used to load the image

    model

    The current model for the component

    animated

    Whether the update should be applied with an animation