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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:19:16+00:00 2026-06-05T10:19:16+00:00

I have created a custom view that contains a UIPickerView and a UITableViewCell to

  • 0

I have created a custom view that contains a UIPickerView and a UITableViewCell to display the contents currently selected in the picker. My PickerViewController is set as both the delegate and dataSource of the picker, and I have implemented numberOfComponentsInPickerView:, pickerView: numberOfRowsInComponent:, and pickerView: titleForRow: forComponent:, but the picker appears blank when the program is run, and thanks to placing NSLog calls in the methods, I’ve discovered that the methods are never getting called. I have no idea what the issue is, as the picker appears to be linked up correctly with the PickerViewController.

For the basic functionality that I’m trying to achieve, look at the “Start & End” view in the iOS Calendar app. I am trying to imitate this exactly, but only using one UITableViewCell instead of three.

PickerViewController.h

#import <UIKit/UIKit.h>

@interface PickerViewController : UIViewController

@property (weak, nonatomic) IBOutlet UITableViewCell *pickerSelection;
// Property to dynamically determine what content to display in the picker.
@property (nonatomic) BOOL userIsChoosingClass;

@end

viewDidLoad

- (void)viewDidLoad {
    [super viewDidLoad];
    NSLog(self.thePicker.delegate.description);
    if (self.userIsChoosingClass) {
        self.pickerSelection.textLabel.text = @"Class";
    } else {
        self.pickerSelection.textLabel.text = @"Major";
    }
}

Picker View Data Source Methods

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
    return 1;
}

- (NSInteger)pickerView:(UIPickerView *)pickerView
numberOfRowsInComponent:(NSInteger)component {
    size_t numberOfRows = 0;

    if (self.userIsChoosingClass) {
        numberOfRows = [self.brain classChoicesForSignUp].count;
    } else {
        numberOfRows = [self.brain majorChoicesForSignUp].count;
    }

    return numberOfRows;
}

Picker View Delegate Methods

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row
            forComponent:(NSInteger)component {
    NSLog(@"Picker view delegate method called");
    NSString *title;

    if (self.userIsChoosingClass) {
        title = [[self.brain classChoicesForSignUp] objectAtIndex:row];
    } else {
        title = [self.majorChoices objectAtIndex:row];
    }

    return title;
}
  • 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-05T10:19:18+00:00Added an answer on June 5, 2026 at 10:19 am

    If your numberOfRows… datasource method is returning 0, then your delegate method will never be called – the picker won’t ask for the title of a row if it doesn’t think it has any rows to display.

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

Sidebar

Related Questions

I have created one custom view that contains the horizontalscrollview. Now when i changes
I have created one custom view that contains the horizontalscrollview. Now when i changes
I have a custom tableview cell created programmatically that consists of: a background view
We have created custom listview by using the Base adapter. List view contains Text
I have created a custom Array Adapter to bind a custom row that contains
I've created a UIViewController which contains a view with a custom class that I've
In a word, how? I have a view controller that creates a few custom
I have created a custom list view, each row has it's own custom selector,
I have created a custom annotation view. In the setSelected method i have implemented
I have created a Dynamic View Panel custom control and want to add 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.