jsanmtosj
jsanmtosj

Reputation: 563

Get phone number in textfield to make a phone call when pressing a button

The application simply wants to make a user input a phone number in a text field and then when a button is tapped, it'll call that number. What's the best code for this? I have already created a button and a textfield in my nib file.

I'm using Xcode 4.

Upvotes: 0

Views: 5136

Answers (2)

Ankur
Ankur

Reputation: 289

-(IBAction)numberButtonPressed:(UIButton *)pressedButton
{

    self.phoneNumberLabel.text = [self.phoneNumberLabel.text stringByAppendingString: pressedButton.titleLabel.text];

}

You can take a look at turorial here:
http://mobile.tutsplus.com/tutorials/iphone/design-build-a-1980s-ios-phone-app-making-phone-calls/

Upvotes: 2

Matt S.
Matt S.

Reputation: 13753

Here shows you how to do it. Just make the NSMutableString phone go to your text field (by using yourTextField.text)

Upvotes: 0

Related Questions