I have images in Images folder, and i would like to initialize an array with strings of file name…
ex:
one.png, two.png, three.png
I would like to initialize my array as [“one”, “two”, “three”]
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try this:
The first part of the code retrieves the names of the files in the given directory, and adds them to the
imagePathsarray.The second part of the code then loops over the image paths in the array and removes the extension from the end (using the
stringByDeletingPathExtensionmethod), appending them to theimageNamesarray, which will contain all the files in the given directory without any file extensions.As
Graham Leehas done in his code, you could provide a pointer to anNSErrorobject to obtain information about the problem, should an error arise.