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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:43:48+00:00 2026-05-20T07:43:48+00:00

All, In Apple’s sample code DateCell http://developer.apple.com/library/ios/#samplecode/DateCell/Introduction/Intro.html the ivar pickerView is declared in MyTableViewController.h

  • 0

All,

In Apple’s sample code “DateCell”

http://developer.apple.com/library/ios/#samplecode/DateCell/Introduction/Intro.html

the ivar “pickerView” is declared in MyTableViewController.h like this:

@interface MyTableViewController : UITableViewController
{
@private
    UIDatePicker *pickerView;
    UIBarButtonItem *doneButton;    // this button appears only when the date picker is open

    NSArray *dataArray;

    NSDateFormatter *dateFormatter;
}

@property (nonatomic, retain) IBOutlet UIDatePicker *pickerView; 
...

It is synthesized in the class file MyTableViewController.m like this:

@implementation MyTableViewController

@synthesize pickerView, doneButton, dataArray, dateFormatter;
...

When this app runs, I can insert NSLog(@"%@",pickerView) into ViewDidLoad and see that, sure enough, the ivar pickerView is real and has a value. Nowhere, though, does this class alloc/init pickerView. And that’s the root of the question: how’s it getting done if it’s not being done explicitly?

Well, I naively copied this stuff to my code into my RootViewController.h and .m files figuring I could do the same, but pickerView stubbornly remains uninitialized (and my NSLog calls return “(nil)” as its value) no matter what I try short of explicitly alloc/initing it. Certainly RootViewController is being instantiated, or the RootView wouldn’t be showing up, right? So shouldn’t my pickerView be coming along for the ride just as it does for Apple?

So… do I have to manually alloc/init the pickerView instance variable? If so, where’s Apple doing it? Or how are they doing it somehow otherwise?

I think I’m missing something very basic here, but I have no idea what it is. I can’t see anything in Interface Builder or XCode that looks different between mine and theirs, but I’ve got tunnel vision at this point and can’t see anything clearly anymore.

Thanks,

Bill

  • 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-20T07:43:49+00:00Added an answer on May 20, 2026 at 7:43 am

    The IBOutlet modifier on this line is the key…

    @property (nonatomic, retain) IBOutlet UIDatePicker *pickerView; 
    

    IBOutlet is a decorator that indicates that the object will be hooked up/connected/initialised when the corresponding xib (Interface Builder) file is loaded. The sample application you’re looking up will contain a UITableViewController is a xib which has a connection to a UIPickerView.

    You can either go the route of creating your own custom xib file and wire to an instance of UIPickerView or you can manually initialise the picker yourself.

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

Sidebar

Related Questions

Been following the Core Data tutorial on Apple's developer site , and all is
On all the sample projects from apple's site (like Simple Drill Down) when I
Apple's iOS Simulator is great- I use it all the time because it is
I have followed all the steps to upload my first application on https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa at
In my company, we have a stupid firewall. It block all itunes.apple.com sites and
I have always wondered why all apple code samples use code like this: UINavigationController
Example page is: http://www.uswitch.com/mobiles/deals/apple_iphone_4s/ This page aggregates all contract deals for a specific handset,
We Really need some help on this one: We've Struggled with all the Apple
With all the normal Apple updates applied (I.E. No additional effort has been made
The Apple dev site makes it look as tho it has all the tools

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.