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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:00:16+00:00 2026-05-23T22:00:16+00:00

When the user presses my ‘import’ button, they must be able to type in

  • 0

When the user presses my ‘import’ button, they must be able to type in a URL, which they can then ‘ok’ or ‘cancel’.

How do I do this?

Obviously I could create a new view containing a text field and 2 buttons. But this seems like over coding.

One solution I found involves ‘ hacking ‘ a UITextField into a UIAlertView: http://iphone-dev-tips.alterplay.com/2009/12/username-and-password-uitextfields-in.html

(EDIT: Better — http://www.iphonedevsdk.com/forum/iphone-sdk-development/1704-uitextfield-inside-uialertview.html#post10643 )

This looks really ugly. It is clearly a hack.

Can anyone provide a better solution (or even a better implementation of the same solution path)?

  • 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-23T22:00:18+00:00Added an answer on May 23, 2026 at 10:00 pm

    OK After a ton of digging, here is the result.

    Firstly, putting in ‘UITextField UIAlertView’ into SO’s search returns dozens of hits.

    It turns out there is a method for doing this, Need new way to add a UITextField to a UIAlertView but it is private API 😐

    Pretty much every other solution involves hacking a UIAlertView, which is ugly:
    http://junecloud.com/journal/code/displaying-a-password-or-text-entry-prompt-on-the-iphone.html
    http://iphone-dev-tips.alterplay.com/2009/12/username-and-password-uitextfields-in.html
    https://github.com/josecastillo/EGOTextFieldAlertView/
    How to move the buttons in a UIAlertView to make room for an inserted UITextField?
    ^ MrGando’s answer is neat
    http://iphonedevelopment.blogspot.com/2009/02/alert-view-with-prompt.html
    Getting text from UIAlertView

    The only proper solution I found (ie coding from scratch from a UIView) is here: https://github.com/TomSwift/TSAlertView

    This is all it takes:

    - (IBAction) importTap
    {
        TSAlertView* av = [[[TSAlertView alloc] init] autorelease];
        av.title = @"Enter URL";
        av.message = @"";
    
        [av addButtonWithTitle: @"Ok"];
        [av addButtonWithTitle: @"Cancel"];
    
    
        av.style = TSAlertViewStyleInput;
        av.buttonLayout = TSAlertViewButtonLayoutNormal;
        av.delegate = self;
    
        av.inputTextField.text = @"http://";
    
        [av show];
    }
    
    // after animation
    - (void) alertView: (TSAlertView *) alertView 
    didDismissWithButtonIndex: (NSInteger) buttonIndex
    {
        // cancel
        if( buttonIndex == 1 )
            return;
    
        LOG( @"Got: %@", alertView.inputTextField.text );
    }
    

    and Presto!

    enter image description here

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

Sidebar

Related Questions

When I cancel an NSOperation (when user presses a button) cancel method is called
Is there an event when the user presses the standby button? I can disable
When the user presses the text Add, then I'd like to create a new
When a user presses the SEND(return) button I want the keyboard to retract and
How can I dismiss dialog in Cocoa application when user presses Esc or Enter
Is there an event that is fired when the user presses the close button?
I have an NSTextField that I hide when the user presses a button. I
When user presses a button from a webview, I open a scrollview activity with
When the user presses a close Button that I created, some tasks are performed
I want to kill the app when user presses the home button. Is there

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.