7

created UIBarButtonItem added Power Image to it.

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

           });

button added to navigation Item on right side.

this.NavigationItem.SetRightBarButtonItem (barBtn_Logout, true);

Issue is Power@2x.png is in green colour. but after run the application its shows in blue.

Can any one advice what i have done wrong here.

Anbu.Karthik
  • 82,064
  • 23
  • 174
  • 143
KkMIW
  • 1,092
  • 1
  • 17
  • 27
  • There is nothing wrong. Probably that navigationBar tintColor is blue. You can change that by using setTintColor: method of navigationBar – caglar Sep 29 '14 at 06:15

2 Answers2

7

Use the always original rendering mode, if you don't want the navigation bar's tintColor property to effect your button's color.

barBtnPower =   new UIBarButtonItem (UIImage.FromBundle("Images/Power@2x.png").imageWithRenderingMode(.AlwaysOriginal)
        , UIBarButtonItemStyle.Plain
        , (sender, args) => {});
Dávid Kaszás
  • 1,877
  • 1
  • 16
  • 20
2

Updated answer with Swift 5

self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(named: "roulette")?.withRenderingMode(.alwaysOriginal), style: .plain, target: self, action: #selector(buttonRouletteClicked))
shahil
  • 941
  • 9
  • 20