Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7906975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:12:31+00:00 2026-06-03T11:12:31+00:00

I have UITextField named textField where user can save phone number with NSUserDefaults .

  • 0

I have UITextField named textField where user can save phone number with NSUserDefaults. Then I have IBAction to call that number. How can I put to that action a number what user have been saved to UITextField?

-(IBAction)callPhone:(id)sender {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:123456"]];
}

UPDATE

- (IBAction) saveBtnPresssed : (id) sender
{
    myString1 = [[NSString alloc] initWithFormat:textField.text];
    [textField setText:myString1];
    NSUserDefaults *stringDefault = [NSUserDefaults standardUserDefaults];
    [stringDefault setObject:myString1 forKey:@"stringKey"];
}


- (void)viewDidLoad
{
    [textField setText:[[NSUserDefaults standardUserDefaults] objectForKey:@"stringKey"]];
    [super viewDidLoad];
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T11:12:32+00:00Added an answer on June 3, 2026 at 11:12 am

    The string you are looking for is returned by:

    [textField text];
    

    If you saved that to user defaults then you can just:

    -(IBAction)callPhone:(id)sender {
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSString *phoneNumberString = [defaults objectForKey:@"key_you_saved_the_number_with"];
    
    //... do what you need with that number here
    

    }

    EDIT:

        [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@"], [defaults objectForKey:@"stringKey"]];
    

    so the resulting string should be “tel:” + the actual number from the text field instead of “tel:123456”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UITextField where user can enter a name and save it. But,
I have a UITextField that I put into a UITableViewCell that I put into
I have a UITextField in my app that accepts decimal amounts for prices (i.e.,
I have an UITextField and I would like that for every tap on a
I have a UITextField that I would like to enable auto completion on by:
I have a UITextField added to an UIAlerView (Kind of adding user to list
I have a UITextField that is the subview of UIScrollView I have there exist
Say, I have an address bar which is a UITextField called textField, and a
I have the following code for UITextField . The problem I'm having is that
I do have Three TextField For Name Phone and Email. On selecting each textField

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.