今天扩展没有正确定位

Zan*_*ton 1 widget ios8 ios-app-extension

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

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

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

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

ktz*_*ang 9

要禁用边距,您必须使用函数widgetMarginInsetsForProposedMarginInsets.

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

func widgetMarginInsetsForProposedMarginInsets(defaultMarginInsets: UIEdgeInsets) -> UIEdgeInsets {
        return UIEdgeInsetsMake(0, 0, 0, 0)
}
Run Code Online (Sandbox Code Playgroud)

祝好运!!

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