iPhone - file properties

前端 未结 2 1222
后悔当初
后悔当初 2021-01-27 15:07

i m creating an application which makes the iphone work as a pendrive for easy file sharing purpose.

In the first stage, i have some files(png, pdf, jpg, zip) in a direc

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-27 15:43

    I hope you will have the file name in NSURL object, if so then you can use the following code to get just the file name and can remove the file extension from the string.

    NSArray *fileName = [[fileURL lastPathComponent] componentsSeparatedByString:@"."];
    NSLog(@"%@",[fileName objectAtIndex:0]);
    

提交回复
热议问题