
Untitled
By: a guest on
May 3rd, 2012 | syntax:
None | size: 0.98 KB | hits: 21 | expires: Never
How to extract a path components from documents directory till my file name?
/Users/priyadarshanjoshi/Library/Application Support/iPhone Simulator/5.0/Applications/A2CD9285-62E9-4447-9945-5D8CE090FB3A/Documents/Wine_12.png
/Documents/Wine_12.png
NSString *relativePathImage1=@"";
BOOL append=NO;
for(NSString *get in [imagePath pathComponents])
{
if([get isEqualToString:@"Documents"])
{
append=YES;
}
if(append==YES)
{
relativePathImage1=[relativePathImage1 stringByAppendingPathComponent:get];
}
}
NSLog(@"relativePathImage1 %@",relativePathImage1);
[strPath componentsSeparatedByString:@"Document"]
NSString *fullPath = // Get the path to your image
NSString *pathWithNoFileName = [fullPath stringByDeletingLastPathComponent];
NSString *myPath = [[pathWithNoFileName lastPathComponent] stringByAppendingPathComponent:[fullPath lastPathComponent]];