Xcode - Storyboard视图大小和位置在打开时被修改 [英] Xcode - Storyboard views size and position modified when opening

查看:204
本文介绍了Xcode - Storyboard视图大小和位置在打开时被修改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到Xcode有些令人讨厌:我有一些故事板,其中某些视图大小和当我打开它们时系统地更新了位置。这是令人讨厌的,尤其是在与团队合作时。



在这里我如何产生这种行为:


  • 我从git存储库中取出应用程序

  • 打开受影响的故事板根本不做任何修改
  • git diff已经告诉我差异


  $ git diff 
...
- < rect key =framex =576.99999828648401y =11width =170height =20/>
+< rect key =framex =577y =11width =170height =20/>
...
- < rect key =framex =518.99999921768904y =7width =228height =30/>
+< rect key =framex =519y =7width =227.99999841338541height =30/>

这是否发生在其他人身上?

问题是:

为什么当我只打开它时,故事板会被修改,以及如何防止它?






注意:

我意识到这似乎只发生在< rect / > 包含在标签 s& Xcode将故事板布局信息保存在一个XML文件中。 textField s

解决方案

(.storyboard)。因此,故事板上的任何更改都将在该XML中反映出来。特别是如果你和队友一起工作,这些信息可能会经常变化。您可以通过移动一些项目(不要更改其他任何项目)来尝试它,然后在您的git存储库中启动diff。您应该再次看到XML中的更改。您可以忽略git结帐中的故事板文件。但是,这样做可能没有多大意义,因为你的队友可能会在故事板中添加新的项目。

可能这也有帮助:[



如果我理解了第一个答案,那么其他更改也可能触发故事板XML文件的更改。



关注
Thomas


I noticed something very annoying with Xcode: I have some storyboards for which certain views size & position are systematically updated when I open them. This is annoying especially when working with a team.

Here how I produce this behavior:

  • I pull the app from a git repository
  • Open an affected storyboard doing no modification at all
  • git diff already tells me differences like

$ git diff
...
- <rect key="frame" x="576.99999828648401" y="11" width="170" height="20"/>
+ <rect key="frame" x="577" y="11" width="170" height="20"/>
...
- <rect key="frame" x="518.99999921768904" y="7" width="228" height="30"/>
+ <rect key="frame" x="519" y="7" width="227.99999841338541" height="30"/>

Is this happening to anybody else ?

The question is:
Why is my storyboard getting modified when I'm only opening it, and how to prevent it ?


Notice:

I realized this seems to happen only on <rect /> contained into labels & textFields

解决方案

Xcode saves the storyboard layout information in an XML file (.storyboard). So any changes on the storyboard will be reflecected in that XML. Especially if you work with teammates this information might change regularly. You can try it out by moving around some items (don't change anything else) and after that start a diff with your git repository. You should see again a change in the XML. You could ignore the storyboard file in your git checkout. But this wouldn't make much sense as your teammates may have added new items to the storyboard.

Maybe this helps as well: [Xcode changes unmodified storyboard and XIB files

If I understand the first answer correct other changes might also trigger a change on the storyboard XML file.

regards Thomas

这篇关于Xcode - Storyboard视图大小和位置在打开时被修改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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