今天在iOS 10中扩展紧凑模式高度 [英] Today Extension compact mode height in iOS 10

查看:113
本文介绍了今天在iOS 10中扩展紧凑模式高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力在紧凑模式下更改iOS 10小部件的高度。

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.

这是我的代码:

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.

    [self.extensionContext setWidgetLargestAvailableDisplayMode:NCWidgetDisplayModeExpanded];

}

- (void)widgetActiveDisplayModeDidChange:(NCWidgetDisplayMode)activeDisplayMode withMaximumSize:(CGSize)maxSize{
    if (activeDisplayMode == NCWidgetDisplayModeCompact) {
        self.preferredContentSize = CGSizeMake(0, 50);
    }
    else{
        self.preferredContentSize = CGSizeMake(0, 200);
    }
}

这可能是测试版软件的问题吗?我在Xcode 8 beta和iOS 10 beta 7上。

Could this be an issue with beta software? I am on Xcode 8 beta and iOS 10 beta 7.

推荐答案

根据来自WWDC 2016的Cocoa Touch 新会议(大约44:00标记):

According to the What's new in Cocoa Touch session from WWDC 2016 (around the 44:00 mark):


现在我们有一个用户控制的大小。紧凑模式,固定高度和扩展模式,可变高度。

Now we have a user controlled size. The compact mode, which is fixed height and the expanded mode which is variable height.

所以,它似乎完全忽略为 NCWidgetDisplayModeCompact 设置 preferredContentSize (固定大小似乎是110pts)。

So, it seems that setting a preferredContentSize for NCWidgetDisplayModeCompact is completely ignored (the fixed size appears to be 110pts).

这篇关于今天在iOS 10中扩展紧凑模式高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆