Shahid Aslam
Shahid Aslam

Reputation: 2585

autolayout center X constraints flips in RTL in iOS 9

I have 2 buttons in a view and following is the screen for RTL works fine:

enter image description here

And in RTL it flips both and shows like this :

enter image description here

I am unable to stop flipping by unchecking respect language direction

enter image description here

I have added Constraint like this :

[English Button [Arabic Button

Its working fine on iOS 8 I want to stop them automatic flipping for iOS 9, Any guidance ?

Upvotes: 1

Views: 596

Answers (2)

Arup Sarker
Arup Sarker

Reputation: 175

or You can use this in appDelegate,

-(BOOL) isGreaterIOSVersion:(NSString*) version
{
    NSString *systemVersion = [[UIDevice currentDevice] systemVersion];
    if ([systemVersion compare:version options:NSNumericSearch] != NSOrderedAscending) {
        return YES;
    }
    return NO;
}

add below code to in didFinishLaunchingWithOptions function

if([self isGreaterIOSVersion:9.0]) {
        [[UIView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight];
    }

it will remove RTL

Upvotes: 0

user242849
user242849

Reputation:

Set the semantic content attribute of the superview to Force Left-To-Right.

Setting the SCA of a view

Upvotes: 3

Related Questions