Open mob-rockstar opened 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.
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 }
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.
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 }
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.