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

  • Home
  • SEARCH
  • 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 582171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:39:31+00:00 2026-05-13T14:39:31+00:00

I have a typical textfield in an iphone app, and in ViewWillAppear I would

  • 0

I have a typical textfield in an iphone app, and in ViewWillAppear I would like to do a little logic using the text in the text field.

If txtField.text is empty, I would like the next textfield, txtField2 to be selected for typing.

I am trying to achieve this through :

if (txtField.text != @"") [txtField2 becomeFirstResponder];

but after some testing, txtField.text (whilst empty), will still not register as being equal to @””
What am I missing?

  • 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-13T14:39:31+00:00Added an answer on May 13, 2026 at 2:39 pm

    When you compare two pointer variables you actually compare the addresses in memory these two variables point to. The only case such expression is true is when you have two variables pointing to one object (and therefore to the very same address in memory).

    To compare objects the common approach is to use isEqual: defined in NSObject. Such classes as NSNumber, NSString have additional comparison methods named isEqualToNumber:, isEqualToString: and so on. Here’s an example for your very situation:

    if ([txtField.text isEqualToString:@""]) [txtField2 becomeFirstResponder];
    

    If you want to do something if a NSString is in fact not empty use ! symbol to reverse the expression’s meaning. Here’s an example:

    if (![txtField.text isEqualToString:@""]) [txtField2 becomeFirstResponder];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a typical login screen(table layout). What I would like to do is
I have a typical form_for for registering user. But in the end I would
I have a long text field and what I want to do is that
I have a typical GWT app, in my module.xml, I have, <inherits name='com.google.gwt.user.theme.standard.Standard' />
I have a typical server in my end and a friend using a client
How do I store and index a typical TEXT field in MySQL. In my
I have a typical Silverlight application with a WCF service and I am using
I have a typical search facility in my app which returns a list of
I have the typical model in Core Data (for iPhone) with Departments and Employesss
I have a typical drill down style app with a DetailViewController that includes a

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.