Class
HSModernWidgetViewController
A widget view controller that specializes in managing a modern widget view.
Declaration
@interface HSModernWidgetViewController : HSWidgetViewController
Description
Subclass HSModernWidgetViewController to implement the primary view of the widget. It provides default behavior for various widget functionality allowing development to focus on implementing the content. The following functionality is provided:
- The minimum size is 2x2 and can be expanded to 4x2.
- By default limited to 1 instance per page.
- Provides a dynamic way of setting the modern widget title using titleLabel.
- Provides a convenient way of adding custom content using contentView.
Modern widgets must support content that can fit both 2x2 and 4x2 grid positions.
Topics
Adding Widgets
-
+ minimumSize
Gets the minimum size required to add the widget to page. Defaults to 2x2.
-
+ allowedInstancesPerPage
Return the number of allowed instances per page so that widget manager can restrict additional instances. Defaults to 1 instance per page.
Initializing A Widget View Controller
-
- initForWidgetFrame:withOptions:
Initialize a newly allocated widget view controller with the specified widget frame and options.
Properties
-
blurView
The blur view used for the background.
-
contentView
Container view in which the content should be added.
-
cornerRadius
Corner radius of the content and editing view.
-
titleLabel
Contains the title of the widget.
Calculate Frame
-
- calculatedFrame
Return the calculated frame of the content view.
Dynamic Sizing
-
- expandWidget
Perform actions when expanding widget.
-
- shrinkWidget
Perform actions when shrinking widget.