今天扩展没有正确定位 [英] Today Extension Not Positioned Correctly

查看:134
本文介绍了今天扩展没有正确定位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个比特币今日扩展,由于某种原因,该控件有一个偏移量。以下是目前的情况: http://i.imgur.com/KxeXePS.png

I'm developing a Bitcoin Today Extension and for some reason, the control has an offset. Here's what it currently looks like: http://i.imgur.com/KxeXePS.png

如您所见,按钮几乎不在屏幕上,标签不在左侧。

As you can see, the button is barely on the screen, and the label isn't on the left side.

我的故事板如下: http://i.imgur.com/6vtfNGJ.png

我已尝试设置多种约束,但似乎都没有解决问题。我不确定我可以添加哪些其他信息,但如果您对该项目有任何疑问,我可以回答它们。

I've tried settings multiple kinds of constraints, and none of them seem to fix the issue. I'm not sure what other information I can add, but if you have any questions about the project, I can answer them.

推荐答案

要禁用边距,你必须使用函数widgetMarginInsetsForProposedMarginInsets。

To disable the margin you have to use the function widgetMarginInsetsForProposedMarginInsets.

将它放在你的代码中(Swift):

Place this in your code (Swift):

func widgetMarginInsetsForProposedMarginInsets(defaultMarginInsets: UIEdgeInsets) -> UIEdgeInsets {
        return UIEdgeInsetsMake(0, 0, 0, 0)
}

祝你好运!!

参考:
https://developer.apple.com/library/prerelease/ios/documentation/NotificationCenter/Reference/NCWidgetProviding_Protocol/index.html# // apple_ref / occ / intfm / NCWidgetProviding / widgetMarginInsetsForProposedMarginInsets

这篇关于今天扩展没有正确定位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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