问题
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
回答1:
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) {}
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"; }
}
来源:https://stackoverflow.com/questions/40327821/swrevealviewcontroller-switch-slideout-menu-direction-from-left-to-right-pragm