The title UIButton is not displayed


I just started developing in Swift.

I created an UIButton dynamically and added it to the View. My issue is the view is not displaying the button.

My Code:

var button:UIButton = UIButton();
button.frame = CGRect(x: 100, y: 250, width: 100, height: 50);
button.setTitle("Midhun", forState: UIControlState.Normal);

Then I added image to the button and then it is showing:

button.setImage(UIImage(named: "step_first.jpg"), forState: UIControlState.Normal);

I couldn't figure out what is happening. Please help

I actually figured out the issue.

In Swift the title of UIButton is white.

I changed the background color of parent View, now it is showing.

self.view.backgroundColor = UIColor.blackColor();