dekatotoro / SlideMenuControllerSwift

iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app. It is written in pure swift.
MIT License
3.4k stars 754 forks source link

SlidingMenuController is not working in RTL mode(Arabic) #373

Open mob-rockstar opened 6 years ago

mob-rockstar commented 6 years ago

I have implemented localization in my app. (English & Arabic) In English, the menu button should be on the top of left side. And sliding menu should be displayed from left side.

In Arabic mode, the menu button should be on the top of right side. And sliding menu should be displayed from right side.

In LTR, it is working well. But RTL mode(Arabic) it doesn't work well. I have displayed menu button using following code in Arabic mode. self.addRightBarButtonWithImage(UIImage(named: "menu")!) self.slideMenuController()?.removeRightGestures() self.slideMenuController()?.addRightGestures() As a result, the menu button is appeared on the top of left side.(should be appeared in left top)

Please let me know if you have good solution.

omegaes commented 6 years ago

No need to use self.addRightBarButtonWithImage(UIImage(named: "menu")!) Because IOS system will automatically reverse it in RTL, so right will be left in RTL and vice versa, so it's enough to use: self.addLeftBarButtonWithImage(UIImage(named: "menu")!) But also in RTL if you clicked left bar button (which will be right) menu will not open, but gesture will work at least, I'm stuck at this point and trying to make it work as expected.

omegaes commented 6 years ago

For me solution was (fit my project): self.addMenuBarButtonWithImage(UIImage(named: "options")!) public func addMenuBarButtonWithImage(_ buttonImage: UIImage) { let action = dataManager().getUserLang()! == "ar" ? #selector(self.toggleRight) : #selector(self.toggleLeft) let leftButton: UIBarButtonItem = UIBarButtonItem(image: buttonImage, style: UIBarButtonItemStyle.plain, target: self, action: action) navigationItem.leftBarButtonItem = leftButton }

navin111 commented 5 years ago

I have implemented localization in my app. (English & Arabic) In Arabic mode, the menu button should be on the top of right side. And sliding menu should be displayed from right side.

navin111 commented 5 years ago

I am using this code but not work.... self.addMenuBarButtonWithImage(UIImage(named: "options")!) public func addMenuBarButtonWithImage(_ buttonImage: UIImage) { let action = dataManager().getUserLang()! == "ar" ? #selector(self.toggleRight) : #selector(self.toggleLeft) let leftButton: UIBarButtonItem = UIBarButtonItem(image: buttonImage, style: UIBarButtonItemStyle.plain, target: self, action: action) navigationItem.leftBarButtonItem = leftButton }