karthikeyan
karthikeyan

Reputation: 3888

Today widget iOS 11 update default height?

what is the default height of today widget extension. iOS 10 it was 110px Based on that we have designed custom table cell with height of 110px to show only one cell and we have option show more to see remaining cell.

The code :

let version = (UIDevice.current.systemVersion as NSString).floatValue
//        print(version)
        if version >= 10 {
            self.extensionContext!.widgetLargestAvailableDisplayMode = NCWidgetDisplayMode.expanded
            self.preferredContentSize = CGSize(width: CGFloat(0), height: CGFloat(350))
        }

func widgetActiveDisplayModeDidChange(_ activeDisplayMode: NCWidgetDisplayMode, withMaximumSize maxSize: CGSize) {
        if activeDisplayMode == NCWidgetDisplayMode.expanded{
            self.preferredContentSize = CGSize(width: CGFloat(0.0), height: CGFloat(350))
        }
        else if activeDisplayMode == NCWidgetDisplayMode.compact {
            self.preferredContentSize = maxSize
        }

    } 

after iOS 11 update it seems default height has increased what could be the default height ?. still i am using Xcode 8.3.3 only.

iOS 11 show less and show more button not working properly.

Thanks in advance.

Upvotes: 0

Views: 1288

Answers (1)

karthikeyan
karthikeyan

Reputation: 3888

There is nothing update in Height, It is still same.

According toDocumentation

Kindly check Design the UI Guidelines

NOTE: Don’t specify a height for your widget that would require a user to scroll to see all its content.

And change your code like below :

let version = (UIDevice.current.systemVersion as NSString).floatValue
//        print(version)
        if version >= 10 {
            self.extensionContext!.widgetLargestAvailableDisplayMode = NCWidgetDisplayMode.expanded
          //  self.preferredContentSize = CGSize(width: CGFloat(0), height: CGFloat(350))
        }

Upvotes: 0

Related Questions