I want to set custom images to the UIBarButtonItem but it only shows a rectangular box around and It doesn\'t show the actual image.
func setupBrowserToolbar
From swift 3, the method is changed to the following format
UIImage(named:"yourImageName")!.withRenderingMode(.alwaysOriginal)
Thats because UIBarButtonItem image's default rendering mode always draw the image as a template image, ignoring its color information (UIImageRenderingModeAlwaysTemplate). Just create your image using UIImage's method imageWithRenderingMode always original.
UIImage(named: "yourImageName")!.withRenderingMode(.alwaysOriginal)