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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:37:30+00:00 2026-05-20T16:37:30+00:00

I have a alert view that has a text field inside of it. Here

  • 0

I have a alert view that has a text field inside of it. Here is the code:

UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"Password" message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Enter", nil];
[myAlert addTextFieldWithValue:nil label:@"Type Password"];
[[myAlert textField] setSecureTextEntry:YES];
[[myAlert textField] setDelegate:self];
[[myAlert textField] setTextAlignment:UITextAlignmentCenter];
[[myAlert textField] becomeFirstResponder];
[myAlert show];
[myAlert release];
myAlert = nil;

I get 4 warnings, each on the lines that include [[myAlert textField]. The warnings I get are “Method -addTextFieldWithValue:label: not found (return type defaults to ‘id’)” and “Method '-textField' not found (return type defaults to ‘id’).” What should I do to fix these? Is there a better way to display a text field within an alert view without any warnings?

  • 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-20T16:37:30+00:00Added an answer on May 20, 2026 at 4:37 pm

    The reason for your warnings is that the UIAlertView class doesn’t have any such methods as addTextFieldWithValue or textField.

    Generally speaking, alert views are not intended for input, other than allowing a choice between a few basic options (“yes/no”, “ok/cancel”, etc). If you need a user to type in a password, your text field should be somewhere on a regular view. It is for exactly this reason the kind of methods you are after are not implemented in UIAlertView.

    For reference: UIAlertView

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

Sidebar

Related Questions

I have created an alert view with two buttons using the following code: UIAlertView
I have a view that has two buttons(First and Second) and one hidden field.
I have got an alertview which has a text field UIAlertView* dialog = [[UIAlertView
I have added a Button in the View { xtype:'button', id:'when_button_click', text:'Button Click', ui:'alert'
I have two views. The User view has some text and a button. I
I have a page that has lots of images and other code that would
I have a partial view that has a number of Div's, each are set
Using MVC3, C#, and the Razor View Engine: I have a form that has
I Have a hidden field that contains a value and my code block within
I have a simple list view with some check boxes in an alert dialog.

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.