Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I working on app which have two language (English and Arabic) , I have implement slide out menu using "SWrevealviewcontroller" lib for left side, I want to switch slide out menu to right side form left side on language change (Arabic) and switch back again to right side to left for english language. How can we archive it? Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
152 views
Welcome To Ask or Share your Answers For Others

1 Answer

Actually you must to get the application language, let's say you have Helper class and put static method to get the language of the application.

Helper.m

+(void)getApplicationLanguage{
//return application language
}

ViewController.m

-(IBAction)menuButtonClicked:(id)sender{
    if ([[Helper getApplicationLanguage] isEqualToString:@"Arabic"]){
       //slide from right
    }else{
     //slide from left
    }
}

I did this on my applications, Hope this works for you

UPDATE:

1.Change the segue identifier to "sw_right". 2. NOW in SWRevealViewController in loadStoryboardControllers mehtod comment first try catch like this

-//        @try
-//        {
-//            [self performSegueWithIdentifier:SWSegueRightIdentifier sender:nil];
-//        }
-//        @catch(NSException *exception) {}
  1. in perform method add this code

    NSString *identifier = self.identifier;

    if (![identifier isEqualToString:SWSegueFrontIdentifier]) {
        if ([[H getApplicationLanguage]isEqualToString:ARABIC_LANGUAGE]) {
            identifier = @"sw_right";
        }else{
            identifier = @"sw_rear";
        }
    

    }


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...