前言:
最近公司項目要做國際化語言切換,上網(wǎng)看了很多帖子,都比較含糊或者沒講到精髓的部分,因此整理了一點(diǎn)自己的東西分享出來。
網(wǎng)上教程:http://www.cocoachina.com/ios/20151120/14258.html
其中,“IB中UIImageView國際化無效”這一段寫的比較含糊,我就單獨(dú)把這一部分整理出來。
一 對UIImageView進(jìn)行擴(kuò)展。
UIImageView+Localizable.h
@property (nonatomic,strong) NSString *newImage;
UIImageView+Localizable.m
- (void)setNewImage:(NSString *)newImage
{
self.image = [UIImage imageWithContentsOfFile:[[GDLocalizableController bundle] pathForResource:newImage ofType:nil]];
}
二 xib設(shè)置 (User Defined Runtime Attributes)

三 GDLocalizableController 詳見demo (https://github.com/xh0129/iOS-Localizable)。