Today Extension: How to work with display mode?

前端 未结 2 1901
甜味超标
甜味超标 2020-12-16 19:52

Widgets now include the concept of display mode (represented by NCWidgetDisplayMode), which lets you describe how much content is available and allows users t

2条回答
  •  无人及你
    2020-12-16 20:10

    Here is a Objective-C one.

    - (void)widgetActiveDisplayModeDidChange:(NCWidgetDisplayMode)activeDisplayMode
                             withMaximumSize:(CGSize)maxSize
    {
        if (activeDisplayMode == NCWidgetDisplayModeCompact) {
            self.preferredContentSize = maxSize;
        }
        else {
            self.preferredContentSize = CGSizeMake(0, 200);
        }
    }
    

提交回复
热议问题