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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:26:23+00:00 2026-06-17T18:26:23+00:00

What is / are the differences between declaring these Protocols these ways? Is it

  • 0

What is / are the differences between declaring these Protocols these ways? Is it just that the ones in the .h file are publicly available?

in .h file:
@interface TestViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>

in .m file:
@interface TestViewController () <UISearchBarDelegate, UISearchDisplayDelegate, UIAlertViewDelegate, MKMapViewDelegate, CLLocationManagerDelegate>
  • 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-06-17T18:26:25+00:00Added an answer on June 17, 2026 at 6:26 pm

    When you add the protocols to the .h file, this tells everyone that includes the header file that the class adheres to the given protocols.

    When you add the protocols to the .m file, this is essentially a private indication that the class adheres to the protocols. Only the implementation knows.

    You should only use the first form (in the .h file) when outside classes need to know that the class adheres to the protocol. You should use the second form (in the .m file) when only the implementation cares.

    In the example you gave, it is highly unlikely that other classes need to know about the class adhering to the table view protocols. Those should be in the .m file. It’s also unlikely any other class needs to know about the search protocols. These are implementation details. These belong in the .m file.

    There may be cases where you use both. This is fine.

    Here’ my guideline. Put it in the .m file unless you have a specific need to let other classes know about the use of the protocol.

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

Sidebar

Related Questions

I would like to know the differences between these two ways of declaring variables.
What's the difference between these two ways of declaring a function? function someFunc() {
What is the difference between these 2 ways of declaring a struct? First way:
What are the main differences between these WPF controls? And when I should use
What the difference between declaring an @property in .h or .m file @property (nonatomic,
What differences are there between declaring: GenericClass<T> genericInst = new GenericClass<T>(); and GenericClass<baseClass> temp
What is the difference between these two: Declaring the base class function virtual and
What are some of the technical differences between memory that is allocated with the
Is there any difference between these methods of declaring and setting a public class
Could someone please explain what's the difference between inheriting from ISerializable interface and declaring

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.