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 6868045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:23:08+00:00 2026-05-27T03:23:08+00:00

I want to get the user name. A simple text input dialog box. Any

  • 0

I want to get the user name. A simple text input dialog box. Any simple way to do this?

  • 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-05-27T03:23:09+00:00Added an answer on May 27, 2026 at 3:23 am

    In iOS 5 there is a new and easy way to this. I’m not sure if the implementation is fully complete yet as it’s not a gracious as, say, a UITableViewCell, but it should definitly do the trick as it is now standard supported in the iOS API. You will not need a private API for this.

    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"This is an example alert!" delegate:self cancelButtonTitle:@"Hide" otherButtonTitles:nil];
    alert.alertViewStyle = UIAlertViewStylePlainTextInput;
    [alert show];
    [alert release];
    

    This renders an alertView like this (screenshot taken from the iPhone 5.0 simulator in XCode 4.2):

    example alert with alertViewStyle set to UIAlertViewStylePlainTextInput

    When pressing any buttons, the regular delegate methods will be called and you can extract the textInput there like so:

    - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ 
        NSLog(@"Entered: %@",[[alertView textFieldAtIndex:0] text]);
    }
    

    Here I just NSLog the results that were entered. In production code, you should probably keep a pointer to your alertView as a global variable or use the alertView tag to check if the delegate function was called by the appropriate UIAlertView but for this example this should be okay.

    You should check out the UIAlertView API and you’ll see there are some more styles defined.

    Hope this helped!

    — EDIT —

    I was playing around with the alertView a little and I suppose it needs no announcement that it’s perfectly possible to edit the textField as desired: you can create a reference to the UITextField and edit it as normal (programmatically).
    Doing this I constructed an alertView as you specified in your original question. Better late than never, right :-)?

    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Hello!" message:@"Please enter your name:" delegate:self cancelButtonTitle:@"Continue" otherButtonTitles:nil];
    alert.alertViewStyle = UIAlertViewStylePlainTextInput;
    UITextField * alertTextField = [alert textFieldAtIndex:0];
    alertTextField.keyboardType = UIKeyboardTypeNumberPad;
    alertTextField.placeholder = @"Enter your name";
    [alert show];
    [alert release];
    

    This produces this alert:

    UIAlertView that uses the UIAlertViewPlainTextInput alertStyle to ask a user name

    You can use the same delegate method as I poster earlier to process the result from the input. I’m not sure if you can prevent the UIAlertView from dismissing though (there is no shouldDismiss delegate function AFAIK) so I suppose if the user input is invalid, you have to put up a new alert (or just reshow this one) until correct input was entered.

    Have fun!

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

Sidebar

Related Questions

I want to get user input in one page, store that in a php
i want to get the user who login now .. how to do this
If I want to get a user input from Console to my Expression Tree.
How do I get and print a char from a user? This want do
If I want to get a user that has the email address of 'me@example.com',
i want to get the full address of user programatically using c# how can
Hello I'm trying to make a simple web chat, and I want the user
i want to do when user go to this page the javascript form will
I want to provide a user-input field in my iPad app, where the user
I want get the time used for a case so I can create an

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.