Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

anmldr

macrumors member
Original poster
Jul 14, 2008
65
0
I would like to alphabetically sort files that are in my Resources
folder. They seem to be listed in the order that I added them to the
project. This is a drug formulary and I am using UIWebView to view a
couple of hundred drug sheets. How can I specify that Xcode show the
files in alphabetical order and not in the order that I add them to
the project...so that I can easily find the file to do some editing?

TIA,
Linda
 

ghayenga

macrumors regular
Jun 18, 2008
190
0
I would like to alphabetically sort files that are in my Resources
folder. They seem to be listed in the order that I added them to the
project. This is a drug formulary and I am using UIWebView to view a
couple of hundred drug sheets. How can I specify that Xcode show the
files in alphabetical order and not in the order that I add them to
the project...so that I can easily find the file to do some editing?

TIA,
Linda

Assuming you're reading those files into an NSArray or NSMutableArray look at the documentation for SortUsingSelector.
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
You want to sort the listing of these files in the project window right?

I don't think there is any built-in feature to do this. You're not the first person to ask. I think it would be possible to do this with applescript but it might take longer to write the script than just do it. Not sure if anyone has ever written such a script and posted it.

The project file is an xml file and you could conceivably open the pbxproj file in a text editor and sort the relevant lines.
 

anmldr

macrumors member
Original poster
Jul 14, 2008
65
0
You want to sort the listing of these files in the project window right?

That is correct. I solved the problem by deleting all of the files from the project window. But, I only deleted the references to these files. Then I went to the folder and (since they are sorted alphabetically in the folder) I re-added all of the files to the project and ta..da! Now they are in alphabetical order :)

Not the ideal way of doing something like this since you could accidentally delete a file or forget to add a file back into the project.

Thanks. This might be a good bug to submit to Apple or a suggested improvement for Xcode. I just thought that I was missing something.

Thank you very much for your reply.
Linda
 

glmonte

macrumors newbie
Oct 21, 2008
12
0
Xcode is a stupid IDE...

Can't do simple things like sorting files. I have more than 100 files in the Resources folder and whenever I would like to rename/delete a file I'm wasting my time to find the file(s).
 

jarruda

macrumors newbie
Apr 12, 2009
2
0
Xcode does indeed have built-in sorting. It's just not in the most intuitive of places.

First, select the folder that you would like sorted.
Now, go to the Edit menu in the main menu bar, and select Sort>By Name.
Ta da! Sorted files.

Unfortunately this doesn't keep it sorted, so you have to do it any time that you add files, but at least it is there.

Edit:
Extra tip that I forgot to mention: Because this functionality is in the menu, you're able to very easily bind a key to it. Personally I used the shortcut key for making a snapshot because I never use it; so all I have to do is highlight the folder I want sorted and press ctrl-apple-s and voila, it's sorted.
 

almo2001

macrumors newbie
Jun 9, 2009
11
2
Xcode does indeed have built-in sorting. It's just not in the most intuitive of places.

First, select the folder that you would like sorted.
Now, go to the Edit menu in the main menu bar, and select Sort>By Name.
Ta da! Sorted files.

Unfortunately this doesn't keep it sorted, so you have to do it any time that you add files, but at least it is there.

Praise the lord!!! THANK YOU FOR THAT!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.