I two bar button items and one search bar in a navigation bar added them programmatically
but when i tried to localize this view just from changing the app language it works perfect but it's changing the position of the bar button item (slide menu button) from left to right and i don't want this to be happened and it make the bar button of the men in a side and the view of the menu in another side like this image below:
and this when tapping the menu button to show it it's showing the menu in another place :
so i just want to stop flipping the bar button items when trying to switch between two different languages and i tried to change the semantic of the navigation controller from story board and programmatically and nothing happened and by the way bar button item has no semantic to control by it self and thanks in advance hope you can help me
CodePudding user response:
- Use rightAnchor instead of trailingAnchor constraint
For menu you have to set
SideMenuManager.default.leftMenuNavigationController SideMenuManager.default.rightMenuNavigationController
then choose which one will open depend on your language. like this
if MOLHLanguage.currentAppleLanguage() == "en"{ let menu = SideMenuManager.default.leftMenuNavigationController! present(menu, animated: true, completion: nil) }else { let menu = SideMenuManager.default.rightMenuNavigationController! present(menu, animated: true, completion: nil) }