[Ios]swift traversal of prefabricated local resource files

Source: Internet
Author: User

I put a bunch of SVG files in front of me, but I used them in bulk and wanted to traverse them directly into a list, so I just went through their names and made their names into an array.

var ss:nsstring = Nsbundle.mainbundle (). resourcepath!//6.0.1 modified the request exclamation pointprintln (ss) Var nsfilemange=Nsfilemanager.defaultmanager () var filelist=nsarray.alloc () filelist=nsfilemange.contentsofdirectoryatpath (SS, Error:nil)//effective extraction of non-library files//Filelist=nsfilemange.directorycontentsatpath (ss)//invalid This method has been canceled in iOS7 and later//Filelist=nsfilemange.subpathsatpath (ss)//valid all project catalog extracts include library//Filelist=nsfilemange.contentsofdirectoryatpath (NSString, Error:nil)//Invalid        ifFileList = =Nil {println ("Nil")        }Else{println (filelist)} var svgname=[String] () var i=0         forItinchfilelist{i++ifIt.pathextension = ="svg"{           //println (IT)//println (it.pathextension)Svgname.append (it asString)ifIt.rangeofstring ("2"). Location! = nsnotfound{//determine if a character is includedprintln (IT)}} }

[Ios]swift traversal of prefabricated local resource files

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.