سؤال

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

هل كانت مفيدة؟

المحلول

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


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

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

NSLog(@"%@",pathSegmentClicked);
NSLog(@"%@",pathURL);

نصائح أخرى

NSURL *pathURL = [NSURL fileURLWithPath:[@"~/Desktop stringByExpandingTildeInPath]];
[pathControl setURL:pathURL];
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top