ios - Asset Catalog: Access images with same name in different folders -
there images.xcassets
in project, contains icons
folder , 2 subfolders (firstfolder
, secondfolder
) images. both of subfolders have same number of icons , same icons names (for different themes of app).
so i'm looking for: need needed icon(for current theme) bundle.
i've tried this:
nsbundle* bundle = [nsbundle bundleforclass:[self class]]; nsstring *imagename = [bundle.bundlepath stringbyappendingpathcomponent:@"icons/firstfolder/neededicon"];
it not work.
click on each folder in assets catalog , select provides namespace
in utilities view:
you see folder becomes blue , can see path image above images.
you can access image this:
imageview.image = uiimage(named: "folder1/image")
or in objective-c:
imageview.image = [uiimage imagenamed:@"folder1/image"];
Comments
Post a Comment