Preet Preet - 9 months ago 161
Swift Question

Today widget in iOS10 height issue in swift

I am trying to set the height for the today widget in iOS10 but it doesn't worked. It was working before in iOS9.


1) Set the display mode to NCWidgetDisplayModeExpanded in viewDidLoad

override func viewDidLoad() {
    self.extensionContext?.widgetLargestAvailableDisplayMode = NCWidgetDisplayMode.expanded

2) implement given protocal method

[![func widgetActiveDisplayModeDidChange(_ activeDisplayMode: NCWidgetDisplayMode, withMaximumSize maxSize: CGSize){
    if (activeDisplayMode == NCWidgetDisplayMode.compact) {
        self.preferredContentSize = maxSize;
    else {
        self.preferredContentSize = CGSize(width: 0, height: 200);

enter image description here