Button added to navigation. The item is always displayed in blue.

created a UIBarButtonItem added Power Image to it.

 barBtnPower = new UIBarButtonItem (UIImage.FromBundle ("Images/ Power@2x.png ") , UIBarButtonItemStyle.Plain , (sender, args) => { }); 
Button

added to navigation. Element on the right side.

 this.NavigationItem.SetRightBarButtonItem (barBtn_Logout, true); 

Problem: Power@2x.png is green. but after launching the app its displays in blue.

Can anyone advise what I did wrong here.

+5
source share
1 answer

Always use the original rendering mode if you do not want the tintColor property of the navigation bar to affect the color of your button.

 barBtnPower = new UIBarButtonItem (UIImage.FromBundle("Images/ Power@2x.png ").imageWithRenderingMode(.AlwaysOriginal) , UIBarButtonItemStyle.Plain , (sender, args) => {}); 
+5
source

Source: https://habr.com/ru/post/1203585/


All Articles