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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:58:09+00:00 2026-05-11T09:58:09+00:00

Can someone explain this method declaration syntax for me? In this function, the number

  • 0

Can someone explain this method declaration syntax for me? In this function, the number of rows of a UIPickerView (slot machine UI on the iPhone) is being returned. From my understanding, the Method is called ‘pickerView‘, and returns an NSInteger.

It passes in a pointer to the UIPickerview called ‘pickerView‘ … first, why is the method called the same name as the parameter?

Next there is NSInteger parameter called component that tells us which component we are counting the rows for. The logic to decide which is in the body of the method.

What is ‘numberOfRowsInComponent? It seems to describe the value we are returning, but it is in the middle of the parameters.

- (NSInteger) pickerView:(UIPickerView *)pickerView   numberOfRowsInComponent:(NSInteger)component {     if (component == kStateComponent)         return [self.states count];      return[self.zips count]; } 
  • 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. 2026-05-11T09:58:10+00:00Added an answer on May 11, 2026 at 9:58 am

    Objective-C methods are designed to be self documenting, and they borrow from the rich tradition of Smalltalk.

    I’ll try to explain what you have here, -(NSInteger) pickerView:(UIPickerView*)pickerView numberOfRowsInComponent:(NSInteger)component.

    • - (NSInteger)
      This first portion indicates that this is an Objective C instance method that returns a NSInteger object. the - (dash) indicates that this is an instance method, where a + would indicate that this is a class method. The first value in parenthesis is the return type of the method.

    • pickerView:
      This portion is a part of the message name. The full message name in this case is pickerView:numberOfRowsInComponent:. The Objective-C runtime takes this method information and sends it to the indicated receiver. In pure C, this would look like
      NSInteger pickerView(UIPickerView* pickerView, NSInteger component). However, since this is Objective-C, additional information is packed into the message name.

    • (UIPickerView*)pickerView
      This portion is part of the input. The input here is of type UIPickerView* and has a local variable name of pickerView.

    • numberOfRowsInComponent:
      This portion is the second part of the message name. As you can see here, message names are split up to help indicate what information you are passing to the receiver. Thus, if I were to message an object myObject with the variables foo and bar, I would type:
      [myObject pickerView:foo numberOfRowsInComponent:bar];
      as opposed to C++ style:
      myObject.pickerView(foo, bar);.

    • (NSInteger)component
      This is the last portion of the input. the input here is of type NSInteger and has a local variable name of component.

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

Sidebar

Ask A Question

Stats

  • Questions 93k
  • Answers 94k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer "What are some ways to gracefully handle the complexity mismatch… May 11, 2026 at 6:44 pm
  • Editorial Team
    Editorial Team added an answer It's not insane, no. Git was originally designed to just… May 11, 2026 at 6:44 pm
  • Editorial Team
    Editorial Team added an answer It can be either negative infinity or NaN (not a… May 11, 2026 at 6:44 pm

Related Questions

Can someone explain this behavior in Generics? I have a generic function in C#
We are trying to implement a REST API for an application we have now.
I have some MATLAB code and some Java code that need to talk with
We all know that generic List<> does not box value types. Why on the

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.