0

I have today extension in my app, using expanded mode with the code:

self.extensionContext.widgetLargestAvailableDisplayMode = NCWidgetDisplayModeExpanded;

and

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

it works OK in new apps but it doesn't work in my existing apps made in previous versions of xcode. the widget is always in compact mode with no "show more/less" button. Any idea why? thanks

pechr
  • 235
  • 1
  • 7
  • http://stackoverflow.com/questions/40482917/how-to-create-widgets-showing-on-home-screen-in-ios-10/40484516#40484516 – Sanju Nov 17 '16 at 12:11
  • http://stackoverflow.com/questions/40653242/today-widget-extension-height-ios10 – Sanju Nov 17 '16 at 12:12

1 Answers1

-1

widgetLargestAvailableDisplayMode Link: https://developer.apple.com/reference/foundation/nsextensioncontext/1649133-widgetlargestavailabledisplaymod

(void)widgetActiveDisplayModeDidChange:(NCWidgetDisplayMode)activeDisplayMode withMaximumSize:(CGSize)maxSize This has been introduced from iOS 10 onwards. Link : https://developer.apple.com/reference/notificationcenter/ncwidgetproviding/1649132-widgetactivedisplaymodedidchange?language=objc

Thats the reason why you are not getting same buttons in iOS 8/9.

Same behavior could be replicated in iOS 8/9 by adding showMore button at bottom of widget , which you could see in other widgets as well.

Ankit Kapoor
  • 1,615
  • 12
  • 18