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:

enter image description here

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

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -