how to recall awakefromnib

253 Views Asked by At

I would like to fetch each control such as UIButton/UILabel/UITextField when the .xib is going to show.And I know I can do it in awakefromnib,but How can I make awakefromnib be called again AUTOMATICALLY.Thanks!

actually,I goal is to localize .xib without follow the IPad/Iphone setting language. I use https://github.com/AliSoftware/OHAutoNIBi18n for localize. Hope someone could give me a suggestion.Thanks again!

1

There are 1 best solutions below

0
On

Why do you want to re invoke of awake from nib?

You can force change of the application language by setting @"AppleLanguages" in UserDefaults before your application classes will be initiated. For example you can override +(void)initialize method in your AppDelegate.

    [[NSUserDefaults standardUserDefaults] setObject:@[@"en", @"fr"] forKey:@"AppleLanguages"];
    [[NSUserDefaults standardUserDefaults] synchronize];

It is not clear way 1, 2, but it works.

Also you can use custom localization subsystem (with redefined "NSLocalizedString...").