我正在寻找一种方法将NSPathControl的路径设置为“〜/ Desktop”。
答案 0 :(得分:4)
[_pathControlOutlet setURL: [NSURL URLWithString: [@"~/Desktop"stringByExpandingTildeInPath] ]];
NSURL *pathURL = [_pathControlOutlet URL];
NSLog(@"%@",[[_pathControlOutlet URL]path]);
NSString *pathSegmentClicked = [[_pathControlOutlet clickedPathComponentCell]title];
NSLog(@"%@",pathSegmentClicked);
NSLog(@"%@",pathURL);
答案 1 :(得分:2)
NSURL *pathURL = [NSURL fileURLWithPath:[@"~/Desktop stringByExpandingTildeInPath]];
[pathControl setURL:pathURL];