Int intsort (ID string2, Id string1, void * locale)
{
Static nsstringcompareoptions comparisonoptions =
Nscaseinsensitivesearch | nsnumericsearch |
Nswidthinsensitivesearch | nsforcedorderingsearch;
Nsange string1range = nsmakerange (0, [string1 length]);
Return [string1 compare: string2
Options: comparisonoptions
Range: string1range
Locale :( nslocale *) locale];
}
-(Void) updatelist {
{
Nsarray * filename = [self getfilenamelistoftype: @ "PNG"
Fromdirpath: [utilities documentspath];
Nsarray * sortedarray;
Sortedarray = [filename sortedarrayusingfunction: intsort context: NULL];
Self. listdata = sortedarray;
[Self. tableview reloaddata];
}
}
-(Nsarray *) getfilenamelistoftype :( nsstring *) type fromdirpath :( nsstring *) dirpath
{
Nsarray * filelist = [[nsfilemanager defaultmanager] contentsofdirectoryatpath: dirpath error: Nil]
Pathsmatchingextensions: [nsarray arraywithobject: type];
Return filelist;
}