XCode 4 中的 plist 编辑:不能再移动行了吗?
这个很愚蠢,而且可能有一个我不知道的极其简单的答案:
我正在尝试编辑我的 Settings.bundle
的 plist 以在我的应用程序中实现首选项。我想调整几个组的顺序,但我不知道如何移动行。在 XCode 3 中,您可以通过拖动行来重新排列它们,但在 XCode 4 中这似乎不再起作用。如果不删除所有内容并以正确的顺序重新创建它们,我该如何重新排列行呢?
谢谢。
This one is stupid, and there's probably a ridiculously simple answer I'm just not aware of:
I'm trying to edit the plist for my Settings.bundle
to implement preferences in my app. I want to tweak the order of a few groups, but I can't figure out how to move rows around. In XCode 3 you could just drag rows around to rearrange them, but it seems this no longer works in XCode 4. Short of deleting everything and re-recreating them in the correct order, how can I re-arrange the rows?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
您可以通过抓住右侧并将其向上移动来移动条目,但不能向下移动。
You can move an entry by grabbing the right side and moving it up, you just can't move it down.
我认为这是一个令人烦恼的问题,很多人都遇到过。
查看:
如何您是否在 Xcode 4 中将 plist 的根对象类型更改为 NSArray
以及:
更改 Xcode 4 用于属性列表的编辑器?
基本上,你不能。将 plist 编辑器更改为 textedit 对我来说是最好的解决方案。您也可以右键单击 plist 文件并选择“打开方式 > 源代码”来编辑 plist raw。
I think it's an annoying gotcha that quite a few have run in to.
Check out:
How do you change a plist's root object type to NSArray in Xcode 4
and:
Change the editor Xcode 4 uses for property lists?
Basically, you can't. Changing the plist editor to textedit was the best solution for me. Also you can right click on the plist file and select "Open As > Source Code" to edit the plist raw.
看起来 XCode 5 中又出现了同样的问题。通过抓住右侧的它,您可以将其拖动,但不能将其放在任何地方。我发现的唯一方法是像 @Ralphleon 所说的那样以源代码形式打开列表,如果您有基本的 XML 技能,那么这很简单。
It looks like the same problem is back in XCode 5. By grabbing it on the right you can drag it around, but you can't drop it anywhere. The only way I found was to open the list as source code like @Ralphleon said, which is simple enough to do if you have basic XML skills.
更新:随着 Lion 和 iOS 5 附带的新 XCode,移动行再次起作用。
Update: With the new XCode that comes with Lion and iOS 5, moving rows works again.
是的,如果您关心首选项在应用程序设置中显示的顺序,那么顺序很重要。
我只是在设置列表中创建一个新项目 (+),我希望在其中放置现有项目。然后复制(单击鼠标右键)现有项目并将其粘贴到新项目的顶部。然后删除所有重复项。
Yes the order matters if you care about the order the preferences appear in your app settings.
I just create a new item (+) in the settings list where I would like an existing item placed. Then copy (right mouse click) that existing item and paste it on top of the new item. And then delete any duplicates.
在 XCode 5.1 中,您可以将行拖放到父项中。您无法直接重新排列同级项,但通过将它们放在父项上,子项会跳到同级项中的顶部。
In XCode 5.1, you can drag rows and drop them to a parent item. You can't rearrange siblings directly, but by dropping them on the parent item, the child jumps to the top among the siblings.
查看应用程序 PlistEdit Pro。它妥善处理一切。不是免费的。但如果您要做大量的 plist 工作,那么这是必不可少的。
这里
Check out the app PlistEdit Pro. It handles everything properly. Not free. But if you're doing lots of plist work it's essential.
Here
在 Xcode 14.3 中,我发现一种有效的方法是找出设置的相反顺序(即从下到上),然后依次选择每个条目,按特定顺序将它们拖到首选项数组的顶部。似乎不可能将每一行拖到数组中除顶部之外的任何其他位置。
我觉得很可笑,这个过程并不比这简单。
In Xcode 14.3, I figured out that an approach that worked was to figure out the reverse order of the settings (i.e. bottom to top), then select each entry in turn, dragging them to the top of the preference items array in that specific order. It did not seem to be possible to drag each row to any other place within the array than the top of it.
I find it rather ridiculous that the process is not simpler than this.