IPhone Flip Layout for RTL Languages

Here is my problem:

I localized my application in Arabic. (This is actually slightly different from normal localization, as I have different goals, one for each language).

On the simulator, the view properly turned upside down due to the automatic layout and the leading / ending part of the constraints, but I cannot get the same result on the device. AutoLayout + RTL + text alignment UILabel shows an example of an inverted view on a simulator.

I also found that it is supported in the auto-layout guide: " Attributes leading and ending are the same as left and right for left-right, such as English, but in a right-to-left environment, such as Hebrew or Arabic, leading and ending same as right and left . " This allows me to think that he should invert the view of how this is done on the simulator.

I use -AppleLanguages (ar_SA)in my circuit on a simulator, which thus reverses the view, but cannot find the correct setting in the device itself to do the same. Setting the language and format of the region to Arabic does not seem to help much. This is on iPhone 4S, iOS 7.0.4

TL;DR: iPhone-, " ", , , , ?

+4
2

:

int main(int argc, char *argv[]) {
    @autoreleasepool {
#if TARGET == TARGET_AR
        NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
        [defaults setObject:[NSArray arrayWithObject:@"ar-SA"] forKey:@"AppleLanguages"];
        [defaults synchronize];
#endif
        return UIApplicationMain(argc, argv, NSStringFromClass([SNFIdleDetectorApplication class]), NSStringFromClass([SNFAppDelegate class]));
    }
}

.

: , @"ar" AppleLanguages, @"ar-SA". , @"ar", , , LTR, .

+4
+3

Source: https://habr.com/ru/post/1532826/


All Articles