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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:08:21+00:00 2026-05-16T12:08:21+00:00

I am curious about conforming a class to UITextFieldDelegate, in the past I have

  • 0

I am curious about conforming a class to UITextFieldDelegate, in the past I have always added it to enable access to methods defined within the protocol. However this last time I forgot to add it, only realising later that it was missing. My question is why does it work with or without, I thought it was needed to correctly access the protocol methods?

@interface MyController : UIViewController <UITextFieldDelegate> {
    UITextField *text_001;
}
@property(nonatomic, retain) IBOutlet UITextField *text_001;
@end

OR:

@interface MyController : UIViewController {
    UITextField *text_001;
}
@property(nonatomic, retain) IBOutlet UITextField *text_001;
@end

WITH:

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    NSLog(@"Return: ... ");
    [textField resignFirstResponder];
    return YES;
}

Cheers Gary

  • 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-16T12:08:22+00:00Added an answer on May 16, 2026 at 12:08 pm

    Delegate declarations are really just there as compiler hints; obviously, you still have to implement the underlying methods. However, the main purpose is to let the compiler double check you when assigning them. If you try to manually (in code, as opposed to IB) assign a delegate which wasn’t declared as such, you’ll frequently get a compiler warning.

    Since Objective-C uses duck-typing for most stuff (if it walks like a duck and quacks like a duck; if it responds to -textFieldShouldReturn:, etc), you’re pretty safe.

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

Sidebar

Related Questions

Just curious about how jaxb works, I have a class annotated as follows: @XmlRootElement(name
Curious about running multiple xvfb displays: I have between 10-50 instances of a script
I am a bit curious about how this works - if I have 5
I'm curious about the underlying implementation of static variables within a function. If I
I'm curious about the possibility of having a .NET class library that provides a
Just curious about a particular scenario of NAT. Let's suppose we have 4 computers
I'm curious about how others have approached the problem of maintaining and synchronizing database
Just curious about SQL syntax. So if I have SELECT itemName as ItemName, substring(itemName,
Just curious about jQuery/Javascript and referring to options within variables. So, I wrote a
I've always been curious about how fast Apple loads its homepage - on Chrome,

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.