Friday 17 October 2014

Jogendra Singh

How create button programmatically in Swift?

UIButton programmatically with the targetAction

How create button programmatically in Swift?


override func viewDidLoad() {
    
    super.viewDidLoad()
    
    let button   = UIButton.buttonWithType(UIButtonType.System) as UIButton
    button.frame = CGRectMake(100, 100, 120, 50)
    button.backgroundColor = UIColor.greenColor()
    button.setTitle("Test Button", forState: UIControlState.Normal)
    button.addTarget(self, action: "buttonAction:", forControlEvents: UIControlEvents.TouchUpInside)
    
    self.view.addSubview(button)
}

func buttonAction(sender:UIButton!)
{
    println("Button tapped")
}

Jogendra Singh

About Jogendra Singh -

I'm Founder of Jogendra.Com. I love to share my bright ideas with the whole blogging community. I'm a good iPhone Application Developer. Apart from Blogging, I love to play Cricket and mobile games (Clash of clans).

Subscribe to this Blog via Email :

1 comments:

Write comments
Anonymous
AUTHOR
7 December 2022 at 04:00 delete

It has all fields for all possible name bets, together with the ‘neighbour’ guess. Although comparable, European, American and French roulette come with totally different odds and profitable probabilities. They are 빅카지노 nicely reflected on the totally different wheel and table layouts and quantity sequences. Paddy Power’s recreation is called as} Pick ‘n’ 36 and features a maximum stake of £100, the same stage as FOBTs before the brand new} restrictions.

Reply
avatar