plist editing in XCode 4: Can you not move rows anymore?
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 t开发者_运维知识库weak 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.
You can move an entry by grabbing the right side and moving it up, you just can't move it down.
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.
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.
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.
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.
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
精彩评论