【问题标题】:NSPathControl set pathNSPathControl 设置路径
【发布时间】:2013-01-10 11:52:32
【问题描述】:

我正在寻找一种将 NSPathControl 的路径设置为“~/Desktop”的方法。

【问题讨论】:

    标签: objective-c path nspathcontrol


    【解决方案1】:
    [_pathControlOutlet setURL: [NSURL URLWithString: [@"~/Desktop"stringByExpandingTildeInPath] ]];
    
    
    NSURL *pathURL = [_pathControlOutlet URL];
    NSLog(@"%@",[[_pathControlOutlet URL]path]);
    
    NSString *pathSegmentClicked = [[_pathControlOutlet clickedPathComponentCell]title];
    
    NSLog(@"%@",pathSegmentClicked);
    NSLog(@"%@",pathURL);
    

    【讨论】:

    • 非常感谢。现在我想知道,如何获取所选路径的字符串。
    【解决方案2】:
    NSURL *pathURL = [NSURL fileURLWithPath:[@"~/Desktop stringByExpandingTildeInPath]];
    [pathControl setURL:pathURL];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-30
      • 2016-05-24
      • 2012-08-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多