Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Today's extension iOS10 Show More/Less

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];
        }];
    }
}

everything work fine. But if I leave the widget in compact mode (with show more option available) and if i rerun/reopen the widget screen and if i tapped on Show More button nothing happens even if the delegate method is triggered. I should press 2 time show more/less until widget starts expanding. I also receive this error:No active animation block!

like image 363
Constantin Saulenco Avatar asked Oct 25 '16 07:10

Constantin Saulenco


2 Answers

I found the issue.

I had edited the self.preferredContentSize even if the widget was in the compact mode.Just check every time when you update the preferredContentSize if widgetActiveDisplayMode is NCWidgetDisplayModeExpanded

like image 73
Constantin Saulenco Avatar answered Oct 17 '22 04:10

Constantin Saulenco


I was having the same issue and then checking out the storyboard I realized that the setting "User Preferred Explicit Size" was enabled.

enter image description here

Disabling that option worked for me.

like image 34
Daniel Rivera Avatar answered Oct 17 '22 05:10

Daniel Rivera