loading images from the correct bundle when localizing storyboards

前端 未结 3 752

I\'m trying to add an option for the user to switch between Arabic & English language from inside the app (without having to re-set the language of the whole iPhone), I

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-31 19:53

    NSBundle *bundle = [LocalizationSystem sharedBundle];  //this get your current bundle
    
    NSString *imgPath = [bundle pathForResource:@"btn-Image" ofType:@"png" inDirectory:nil];
    [self.btnTest setImage:[UIImage imageWithContentsOfFile:imgPath] forState:UIControlStateNormal];
    

提交回复
热议问题