Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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]];
Advertisement
Add Comment
Please, Sign In to add comment