I want to change order in plist file not programmatically but from xcode. Is there a way in Xcode where i can sort by value? I simply want to arrange it for myself. For now if i want add new item it will always goes to tail.
How to sort it ? To 100 value go to the top?
Here is the (mildly infuriating) answer, at least in the case of Items in a Settings.bundle's plist, which I realize was not the OP's situation.
To arbitrarily reorder items in a plist:
Target the row by clicking within the Value column. The left-most columns don't allow dragging.
Drag into the first ~64 pixels of the Key column. A blue line appears to indicate where the row will appear when you let go.
Here's a demonstration in Xcode 9.2.
As if that's not already super confusing…
Preference Items, Vertical Drag
You can drag and drop vertically (i.e., without entering the Key column), but only if your goal is to move the item to be first in the list.
Apple Clearly Knows How to Do This
Once you open an Item, elements within it can be dragged and dropped exactly as you'd expect.
Wat!? Yeah. This doesn't need to be so painful, but it's likely to remain this way unless folks get up in arms which, once you know the workaround, it's hard to do. But in case you're feeling sufficiently incensed, make your voice heard: http://bugreporter.apple.com. (Fwiw, here's my Open Radar.)
Your can edit a plist file with an text editor. Right click on plist file -> open as -> source code.
and i think you have to put you strings in an Array
Related
I want to display two paired lists with an input -> output setup. For example, list one might be (a,b,c,d,e) and the second might be (1,2,3,4,5). The user should be able to scroll both lists at once. That way the user can see which pairs match up. It would be nice if the user could drag and drop to sort the list, but that isn't a requirement, I can make do without it.
I tried Taifun's sortable list, but I can't scroll two of those lists together.
I have also tried two list views inside a horizontal arrangement inside a vertical scroll, with the list view heights as automatic, so they are as tall as the elements inside so that the vertical scroll can move up and down instead. The problem with that is when the list view height is set to automatic, it doesn't change sizes to fit its elements.
Does anyone know how to do this?
I decided to use the following setup, and I am pretty happy with how it turned out.
When the user presses "Add item", they can enter an input (segment) and output (replacement). The items show up on a sortable list view, separated by a special dash character so I can break them back up into two paired lists. If someone tries to use that dash, theirs is replaced with a normal hyphen (-). Because the list view trims spaces, the first leading and the last trailing spaces (if any) are replaced with a caret and converted back when saving (^). When the user presses delete, a normal list view appears where the user can click on a pair and is prompted to delete it. The Settings button in the screenshot is just a back button to the main settings menu.
I hope this helps anyone looking for a way to display two paired lists together while avoiding the problems of scrolling and an overly complicated UI.
When I do a multiple selection from, say, the find dialog (Alt-Enter), I sometimes find that many of the selected bits are off screen, but I'd like to check the context of all of them before I start doing a multiple edit.
Is there a way to, say, cycle through them in the view (without disrupting the selections)?
Probably the easiest way is to not do a "Find All", but instead highlight (or do a single Find) what you're looking for, then use ⌘D on OS X/CtrlD on Win/Lin to sequentially add the next matches. If you come to a match you don't want to select, just use ⌘K,⌘D (or CtrlK,CtrlD) to skip the current instance and go on to the next one. ⌘U (CtrlU) is "soft undo", it moves back to the previous selection in case you made a mistake.
Alternatively, I use a color scheme with a very bright selection color (it's bright blue surrounded by bright green) so that selected regions are very easy to identify. This way I can just glance at the minimap and see where selections are, and scroll through my file quickly to ensure everything looks good. If you find a selection you don't want, you can deselect it with Alt+middle mouse button on Win/Lin, or by ⌘Shift+click on OS X. You may need to set "drag_text": false in your Preferences for it to work, though (I'm not on my Mac at the moment to test).
I've found a working solution, but it's not ideal and only works if you're ok with losing the selections (eg: with multiple selections, hit Right Arrow - you've still got multiple cursors, but the selections are gone).
It goes like this:
Make sure there is no code folding - it appears to interfere with this sort of manipulation of multiple selections.
Use altEnter in the search dialogue to select all occurrences of your regex.
Scroll through the selections until you find one you don't want (MattDMo's Neon plugin is helpful here).
Use a cursor movement to lose the selections (multiple cursors remain).
Use Alt+Left Click on the undesired cursor.
Repeat 5. as required. Making another (multiple) selection can be helpful here to locate the other cursors (eg: Control/CommandShiftLeft Arrow)
If you remove a cursor by mistake, or need to add one, use Control/Command+Left Click
I have to take some long code that I wrote when I didn't know too much and change all the hard-coded numbers to something else .
The numbers are positions on screen, and now I need to make them relative to screen size.
So every 160 on code should turn into winSize.width/2, and 80 = winSize.width/4.
Is there a simple way to do that in Xcode?
Press
Command+F
when you are ion the file which needs changes.
You will see a bar at the top. On left side there is Find written. Click on it. Yoy will get an option Replace.
Choose Replace.
In String Matching write 160.
In below filed write winSize.width/2. Click on Replace All button.
Do it for value 80 as well.
Or Right Click -> Refactor... -> Rename also works as well as F&R. It gives you an automatic diff like preview of the changes as well, which I think F&R does but you have to click an additional button to get at it.
You can use the Find and Replace from the Project Navigator view
How do I switch between the header and implementation file in Xcode 4?
In XCode 3 it was cmd and right or left (I think)
Ctrl+Cmd+Up or Down, but the shortcut seems a bit finicky and sometimes stops working, not yet sure when and why.
Be sure to FIRST click ON the actual code window...
that's the critical tip to ensure it works. Click anywhere at all on the actual code. (If you're active in one of the other many panes of Xcode, the keystroke combo has no, or different, meaning(s).)
Also, you can 3 finger swipe up and down on the touchpad if you have one.
Ctrl+Cmd+Up or Down
The shortcut sometimes stops working!!
The menu option has moved to "Navigate->Jump to Next Counterpart" and "Navigate->Jump to Previous Counterpart".
In preferences the key binding is now under "Jump to Next Counterpart" and "Jump to Previous Counterpart".
Why Apple insist on changing the menu positions AND names of these things is beyond me! I mean "Counterpart"!?
Worth nothing that Ctrl+Cmd+Left or Right move between previous and next files that were viewed (I mean "counterparts") too. These are also under the key bindings "Jump to Next Counterpart" & "Jump to Previous Counterpart").
The reason the menu option has been split between:
"Navigate->Jump to Next Counterpart" and "Navigate->Jump to Previous Counterpart"
is because you can have more than just one header file and one source file with the same file name. Besides having matching .xib files for view controllers, I have separate .vsh and .fsh files for vertex and fragment shaders in my OpenGL program. Along with my .h and .cpp files that's a list of 4 files that I can navigate up or down through with one key binding, instead of hitting the same key binding 3 times in a row to cycle back from file 2 to file 1.
Also in Xcode 6.1/7.1 shortucts are the same:
Jump to next counterpart:
Ctrl+Cmd+Up
Jum to previous counterpart:
Ctrl+Cmd+Down
Personally, coming from eclipse, I change this shortcut with:
Ctrl+Tab
this combination insn't already binded to anything else.
Xcode -> Preferences -> Key Bindings
search for "Jump to next counterpart" and put the new keys combination.
PRO
This is more efficient than default bindings see that you can use one hand instead of two!
"but the shortcut seems a bit finicky and sometimes stops working, not yet sure when and why."
Sometimes Xcode loses track of which .m and .h belong together. This is e.g. the case
when you open one of the files directly from the Finder. When you open the file from
the file list in Xcode, it normally works okay. Although when you have moved files between
folders & groups in the file list of Xcode, it will also list the relation between the files.
The command to swap between m and h files is CTL-CMD-up/down. It sometimes get stuck. To unstick it simply save the file, i.e. CMD-S, and the hotkey should work again.
Often, when I am reading code or debugging, I want the ability to quickly jump around files. I especially want to "go back" to where I was. I know about "Command+T", "Command+Shift+T", and, bookmarks. But, I cannot figure out a way to jump around files quickly.
UPDATE: I do not think I my question was clear enough judging by two answers given. Specifically, I am looking for a way to "jump back" to where I was in a file. I know how to navigate in TextMate (in general). I want to know if TextMate has a "jump back" key binding.
It's subtle.
The command-T thing has the files listed in Most Recently Used order.
So, you can go command-T return to get back to your last file real quick. At first I couldn't find it either.
I don't think there's a go to last edit location as there is in, say, IDEA/RubyMine.
Courtesy of MacroMates.com
2.3 Moving Between Files (With Grace)
When working with projects there are a few ways to move between the open files.
The most straightforward way is by clicking on the file tab you need. This can also be done from the keyboard by pressing ⌘1-9, which will switch to file tab 1-9.
You can also use ⌥⌘← and ⌥⌘→ to select the file tab to the left or right of the current one.
It is possible to re-arrange the file tabs by using the mouse to drag-sort them (click and hold the mouse button on a tab and then drag it to the new location). This should make it possible to arrange them so that keyboard switching is more natural.
One more key is ⌥⌘↑ which cycles through text files with the same base name as the current file. This is mainly useful when working with languages which have an interface file (header) and implementation file (source).
When you want to move to a file which is not open you can use the Go to File… action in the Navigation menu (bound to ⌘T). This opens a window like the one shown below.
Go To File
This window lists all text files in the project sorted by last use, which means pressing return will open (or go to) the last file you worked on. So using it this way makes for easy switching to the most recently used file.
You can enter a filter string to narrow down the number of files shown. This filter string is matched against the filenames as an abbreviation and the files are sorted according to how well they match the given abbreviation. For example in the picture above the filter string is otv and TextMate determines that OakTextView.h is the best match for that (by placing it at the top).
The file I want is OakTextView.mm which ranks as #2. But since I have already corrected it in the past, TextMate has learned that this is the match that should go together with the otv filter string, i.e. it is adaptive and learns from your usage patterns.
If you have a project window open, you can leave frequently-accessed files open (in tabs), and then use ⌘+1-9 to jump to open tabs.