3

I am looking for a way to set the path of an NSPathControl to be "~/Desktop".

Martin G
  • 17,357
  • 9
  • 82
  • 98
k4lls
  • 141
  • 3
  • 12

2 Answers2

4
[_pathControlOutlet setURL: [NSURL URLWithString: [@"~/Desktop"stringByExpandingTildeInPath] ]];


NSURL *pathURL = [_pathControlOutlet URL];
NSLog(@"%@",[[_pathControlOutlet URL]path]);

NSString *pathSegmentClicked = [[_pathControlOutlet clickedPathComponentCell]title];

NSLog(@"%@",pathSegmentClicked);
NSLog(@"%@",pathURL);
  • Thank you very much.Now I am wondering, How do I get the a string of the selected path. – k4lls Jan 10 '13 at 22:23
2
NSURL *pathURL = [NSURL fileURLWithPath:[@"~/Desktop stringByExpandingTildeInPath]];
[pathControl setURL:pathURL];
NSGod
  • 22,699
  • 3
  • 58
  • 66