Class

HSWidgetViewController

A view controller that specializes in managing a widget view.


Declaration


@interface HSWidgetViewController : UIViewController

Description

Subclass HSWidgetViewController to implement the primary view of the widget. It provides default behavior for various functionality allowing widget development to focus on implementing the content. It provides the following functionality:

  • Implements the loadView to setup the unclipped view allowing content outside of the bounds to receive events.
  • Implements the viewDidLoad to setup the editing view and accessories while providing customization via cornerRadius and calculatedFrame.
  • Implements loading of classes and widget display info from Info.plist while also allowing dynamic overriding of the values.
  • Allowing custom widget availability via isAvailable.
  • (Required) Providing a way to specify the starting grid size of the widget.
  • Provides default implementation for creating/managing the preference options.
  • Allowing widgets to enable accessories such as Expand, Shrink and Settings. While automatically enabling settings accesosry when a valid preference options class is provided.
  • Provides convenience methods for managing expanding and shrinking accessories.
  • Provides default implementation for zoom animation view while allowing overridability.

When creating a subclass, minimumSize needs to be implemented so that widgets manager knows when to allow addition of the widget. You may override any of these methods; but if you do, be sure to invoke the super class implementation for consistency.

Topics


Widget Information


Adding Widgets


Initializing A Widget View Controller


Properties

  • widgetFrame

    A structure that represents the current grid frame of the widget.

  • requestedSize

    The requested view size for the widget.

  • _gridPositions

    An array of grid positions that the widget current occupies.

  • cornerRadius

    Corner radius of the content and editing view.


Delegate


Calculate Frame


Accessories


Dynamic Sizing


Adding Preferences


Zoom Animation


Animation Constants


Notifications

Related Links


Getting Started