I created UISearchBar programmatically as below and the button appears to be of second image.How to clear the white color of search bar and set background colour to Black
var categorySearchBar : UISearchBar = UISearchBar()
categorySearchBar.frame = CGRectMake(0, 20, self.view.frame.size.width, 30)
categorySearchBar.layer.borderColor = UIColor.grayColor().CGColor
categorySearchBar.layer.borderWidth = 1.0
categorySearchBar.placeholder = "SEARCH"
categorySearchBar.barTintColor = UIColor.blackColor()
self.view.addSubview(categorySearchBar)