Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Button added to navigation Item always shows in blue colour

created UIBarButtonItem added Power Image to it.

barBtnPower =   new UIBarButtonItem (UIImage.FromBundle ("Images/[email protected]")
        , UIBarButtonItemStyle.Plain
        , (sender, args) => {

           });

button added to navigation Item on right side.

this.NavigationItem.SetRightBarButtonItem (barBtn_Logout, true);

Issue is [email protected] is in green colour. but after run the application its shows in blue.

Can any one advice what i have done wrong here.

like image 725
KkMIW Avatar asked Sep 29 '14 05:09

KkMIW


2 Answers

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/[email protected]").imageWithRenderingMode(.AlwaysOriginal)
        , UIBarButtonItemStyle.Plain
        , (sender, args) => {});
like image 127
Dávid Kaszás Avatar answered Nov 07 '22 01:11

Dávid Kaszás


Updated answer with Swift 5

self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(named: "roulette")?.withRenderingMode(.alwaysOriginal), style: .plain, target: self, action: #selector(buttonRouletteClicked))
like image 2
shahil Avatar answered Nov 07 '22 02:11

shahil