My app supports both English and Arabic. interactivePopGestureRecognizer
works properly when using English, ie on swiping from left to right, it pops viewController. But when i am using arabic, I have changed the semanticContentAttribute
from right to left.
if([[[NSUserDefaults standardUserDefaults] objectForKey:@"LanguageCode"] isEqualToString:@"en"])
{
[[UIView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight]; //View for English language
}
else
{
[[UIView appearance] setSemanticContentAttribute:UISemanticContentAttributeForceRightToLeft]; //mirror view for Arabic language
}
But the interactivePopGestureRecogniser
is still from left to right. How can I change the direction of interactivePopGestureRecogniser
such that it supports Arabic? I want to swipe from right to left to pop view controller on using Arabic language.
After a lot of trials, the only solution worked for me was this:
Swift 3:
You can exclude the semantic attribute for certain types like: