Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Sep 16, 2008, 02:39 PM   #1
anmldr
macrumors member
 
Join Date: Jul 2008
Sorting of files in Xcode

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
anmldr is offline   0 Reply With Quote
Old Sep 17, 2008, 08:04 PM   #2
ghayenga
macrumors regular
 
Join Date: Jun 2008
Quote:
Originally Posted by anmldr View Post
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.
ghayenga is offline   0 Reply With Quote
Old Sep 17, 2008, 08:33 PM   #3
PhoneyDeveloper
macrumors 68030
 
PhoneyDeveloper's Avatar
 
Join Date: Sep 2008
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.
PhoneyDeveloper is offline   0 Reply With Quote
Old Sep 18, 2008, 12:55 AM   #4
anmldr
Thread Starter
macrumors member
 
Join Date: Jul 2008
Quote:
Originally Posted by PhoneyDeveloper View Post
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
anmldr is offline   0 Reply With Quote
Old Sep 30, 2008, 11:40 PM   #5
tedsmith3rd
macrumors member
 
Join Date: Aug 2006
Location: US
Posting this one for the search engines.

An Apple staffer created a tool to do this for the WebKit project. It is a short perl script which sorts the file list in an Xcode project. You can download it from the WebKit project's source repository.

http://trac.webkit.org/browser/trunk...ile?format=txt
tedsmith3rd is offline   0 Reply With Quote
Old Feb 23, 2009, 04:06 AM   #6
glmonte
macrumors newbie
 
Join Date: Oct 2008
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).
glmonte is offline   0 Reply With Quote
Old Feb 23, 2009, 05:47 AM   #7
caveman_uk
Guest
 
caveman_uk's Avatar
 
Join Date: Feb 2003
Location: Hitchin, Herts, UK
Subfolders?
caveman_uk is offline   0 Reply With Quote
Old Apr 12, 2009, 03:44 PM   #8
jarruda
macrumors newbie
 
Join Date: Apr 2009
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.

Last edited by jarruda; Apr 12, 2009 at 04:32 PM.
jarruda is offline   0 Reply With Quote
Old Jan 8, 2010, 06:21 PM   #9
almo2001
macrumors newbie
 
Join Date: Jun 2009
Quote:
Originally Posted by jarruda View Post
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!
almo2001 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Sorting files by size in Finder userjoy OS X Mavericks (10.9) 7 Mar 24, 2014 01:46 AM
sorting files in folder? kat.hayes OS X Mavericks (10.9) 2 Feb 21, 2014 12:42 AM
Sorting files numerically? Silvereel Mac Basics and Help 1 Jan 7, 2013 03:22 AM
MKV files no longer sorting as video? DaGrandMastah OS X 0 Dec 27, 2012 11:24 AM
sorting files by suffix stacyphi Mac Basics and Help 2 Aug 31, 2012 10:08 AM

Forum Jump

All times are GMT -5. The time now is 10:05 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC