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

I switched from WEBrick to Phussion Passenger following this guide: http://developer.apple.com/library/mac/#featuredarticles/PhusionRails/index.html . I used
I have always wondered why all apple code samples use code like this: UINavigationController
I've read all Apple documentation on the iPhone development and there's nothing that describes
I got a crash report and the crashing thread's call stack all show Apple's
We have our app all ready to upload to Apple for approval but have
What does AudioServicesCreateSystemSoundID do? All I was able to find was this from Apple's
I am trying to load a html page through UIWebview.I need to disable all
I'm looking for a way to listen in to all Apple Events send by
Hi all why apple has given link of entrust ssl ,is it necessary ?
Officially Apple let developers deploy apps that's compatible with iOS 3.0 to iOS 4.2.

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.