Note that there are some explanatory texts on larger screens.

plurals
  1. POObjective-C code to generate a relative path given a file and a directory
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COcertainly we could all write one (or dig one up), but you're asking would send off bells. you should try to use `NSFileManager`, especially on iOS. Apple is in a long-term process of closing off the file system to the User, and in the process formalizing how the programmer should/can access something. dot dot slashing your way around is a good way to run amok of their app - - - that said `[NSString pathComponents]` will help you decompose them and start from there
      singulars
    2. COWarning noted. For my particular use case, I'm operating exclusively within my app's sandbox on iOS. I have a full path to a file which I need to pass to an API which assumes a path relative to a particular directory and will not accept full paths ([`imageNamed`](http://developer.apple.com/library/ios/documentation/uikit/reference/UIImage_Class/Reference/Reference.html#//apple_ref/occ/clm/UIImage/imageNamed:)). I realize I have the tools to craft this, but I expect someone has a well-debugged version in their toolkit which would be of general use to SO visitors. No sense reinventing the wheel.
      singulars
    3. COare you sure? i have a great 6-sided wheel for sale ;-) - - - i'm sure you know the caveats that come with `imageNamed:` - - - it will hold a copy of the image data until the app quits, use only for small, frequently and always used images - - - if that's not the case use `imageWithContentsOfFile:` - - - i would never use `imageNamed:` on something not in the app top level bundle or you end up with names with ..s in them …
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload