ios10-today-widget

Today Extension compact mode height in iOS 10

此生再无相见时 提交于 2019-12-20 17:41:01
问题 I am struggling to change the height of my iOS 10 widget in compact mode. All I have is an empty widget, no views inside it. Still, no matter what I set for the compact height, it seems to ignore it. Here is my code: - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. [self.extensionContext setWidgetLargestAvailableDisplayMode:NCWidgetDisplayModeExpanded]; } - (void)widgetActiveDisplayModeDidChange:(NCWidgetDisplayMode)activeDisplayMode

Today's extension iOS10 Show More/Less

半城伤御伤魂 提交于 2019-12-13 12:06:19
问题 Had updated the today's extension for iOS 10 implement the delegate method: -(void)widgetActiveDisplayModeDidChange:(NCWidgetDisplayMode)activeDisplayMode withMaximumSize:(CGSize)maxSize { if (activeDisplayMode == NCWidgetDisplayModeCompact){ [UIView animateWithDuration:0.25 animations:^{ self.preferredContentSize = maxSize; [self.view layoutIfNeeded]; }]; } else if (activeDisplayMode == NCWidgetDisplayModeExpanded){ newHeight = [self getNewWidgetHeight]; [UIView animateWithDuration:0.25

iOS10 widget “Show more” “Show less” bug

蹲街弑〆低调 提交于 2019-12-11 02:11:26
问题 I have implemented the new widget for iOS 10 and I have used the following code to set the height for it: @available(iOSApplicationExtension 10.0, *) func widgetActiveDisplayModeDidChange(activeDisplayMode: NCWidgetDisplayMode, withMaximumSize maxSize: CGSize) { if activeDisplayMode == NCWidgetDisplayMode.Compact { self.preferredContentSize = CGSizeMake(0.0, 350.0) } else if activeDisplayMode == NCWidgetDisplayMode.Expanded { self.preferredContentSize = desiredSize } } And it´s working fine,

Change NCWidgetDisplayMode programmatically in IOS10 Widget

泪湿孤枕 提交于 2019-12-06 03:20:18
问题 I am looking to programmatically change the height of a today extension. As the iOS10 SDSK introduced NCWidgetDisplayMode I am trying to use it to programmatically change the height of my preferredContentSize . I have implemented widgetActiveDisplayModeDidChange : @available(iOSApplicationExtension 10.0, *) func widgetActiveDisplayModeDidChange(activeDisplayMode: NCWidgetDisplayMode, withMaximumSize maxSize: CGSize) { if (activeDisplayMode == NCWidgetDisplayMode.Compact) { self

Today Widget Extension Height - iOS10

青春壹個敷衍的年華 提交于 2019-12-04 16:40:13
问题 The height for the Today's widget view mode cannot be set for compact Mode. No matter whatever value I set. It sets the height of the widget to a default value. The expanded mode works perfect and the value is properly set and reflected in the widget. I have already added this line in my viewDidLoad() method. self.extensionContext?.widgetLargestAvailableDisplayMode = .expanded Here is the code. The value of maxSize cannot be changed too as its a constant. func widgetActiveDisplayModeDidChange

Change NCWidgetDisplayMode programmatically in IOS10 Widget

ぐ巨炮叔叔 提交于 2019-12-04 08:13:40
I am looking to programmatically change the height of a today extension. As the iOS10 SDSK introduced NCWidgetDisplayMode I am trying to use it to programmatically change the height of my preferredContentSize . I have implemented widgetActiveDisplayModeDidChange : @available(iOSApplicationExtension 10.0, *) func widgetActiveDisplayModeDidChange(activeDisplayMode: NCWidgetDisplayMode, withMaximumSize maxSize: CGSize) { if (activeDisplayMode == NCWidgetDisplayMode.Compact) { self.preferredContentSize = maxSize } else { self.preferredContentSize = CGSize(width: maxSize.width, height: 280) } } I

Today's extension iOS10 Show More/Less

て烟熏妆下的殇ゞ 提交于 2019-12-04 04:24:01
Had updated the today's extension for iOS 10 implement the delegate method: -(void)widgetActiveDisplayModeDidChange:(NCWidgetDisplayMode)activeDisplayMode withMaximumSize:(CGSize)maxSize { if (activeDisplayMode == NCWidgetDisplayModeCompact){ [UIView animateWithDuration:0.25 animations:^{ self.preferredContentSize = maxSize; [self.view layoutIfNeeded]; }]; } else if (activeDisplayMode == NCWidgetDisplayModeExpanded){ newHeight = [self getNewWidgetHeight]; [UIView animateWithDuration:0.25 animations:^{ self.preferredContentSize = CGSizeMake(0, newHeight); [self.view layoutIfNeeded]; }]; } }

Today Widget Extension Height - iOS10

…衆ロ難τιáo~ 提交于 2019-12-03 10:49:05
The height for the Today's widget view mode cannot be set for compact Mode. No matter whatever value I set. It sets the height of the widget to a default value. The expanded mode works perfect and the value is properly set and reflected in the widget. I have already added this line in my viewDidLoad() method. self.extensionContext?.widgetLargestAvailableDisplayMode = .expanded Here is the code. The value of maxSize cannot be changed too as its a constant. func widgetActiveDisplayModeDidChange(_ activeDisplayMode: NCWidgetDisplayMode, withMaximumSize maxSize: CGSize) { //self

Sharing UserDefaults between extensions

强颜欢笑 提交于 2019-11-29 05:35:44
问题 Creating a Today widget and I am using UserDefaults(suiteName:) to persist some data. In the main application I am using UserDefaults.standard() . This can't be read (or can it?) by the extension which is why I use the suiteName: constructor. Data that user persist to UserDefaults.standard() in the main app needs to be available in the extension. At this time I am persisting to both so that the values can be shared UserDefaults.standard().set:...forKey:... UserDefaults(suiteName:...)().set:..