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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:34:53+00:00 2026-05-11T05:34:53+00:00

I have a View Controller I’m reusing to edit individual objects (NSString, NSNumber, NSDate)

  • 0

I have a View Controller I’m reusing to edit individual objects (NSString, NSNumber, NSDate) in a previous View Controller’s TableView. I’m loosely basing this off of the EditingViewController in Apple’s SQLiteBooks sample project. the datePicker is instantiated in the nib file.

The issue here is it works fine & dandy for the first date I set with it. BUT, when called again on a 2nd date it will correctly display the next date I’m editing in its tumblers(?) when it loads, however, the highlighted (blue) month, day & year are those from when the picker was first displayed BEFORE the first edit. How can I set those highlighted values to the initial value of the 2nd date object or reset the whole UIdatePicker instance.

2nd related question (bonus points 😉 as I struggle to wrap my head around Cocoa: why, in the SQLiteBooks example is there no @property or @synthesize statements for the datePicker declared in EditingVewController.h? Or have I overlooked the obvious? Thanks!

Edit: After some experimentation with other apps using UIDatePickers it appears that for whatever reason UIDatePicker when used in the Date mode will highlight the current month, day & year even if you’re editing an date from say 1776. HOW can we turn this behavior off?

  • 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-11T05:34:54+00:00Added an answer on May 11, 2026 at 5:34 am

    Store the date from the first picker in, e.g. storedDate. Then set the date to be displayed in your UIDatePicker using its date property. Assume your UIDatePicker is named picker, then

     picker.date = storedDate; // picker's date is initialised to today's date/time 

    You can also use this method if you want the picker to animate to your date:

    [picker setDate:storedDate animated:YES]; 

    As for the properties, it’s not true that they should only be used on public data. Properties refer to data that is accessed through methods instead of being directly accessed through instance variables. The property declarations (specifically, the @synthesize) tell the compiler to use these declarations to automatically generate accessor methods as needed to satisfy your class’s interface.

    The dot syntax in Objective-C is translated by the compiler to the invocation of accessor methods. So…

    foo.bar = @'hello'; 

    Is translated by the compiler to…

    [foo setBar:@'hello']; 

    setBar, also generated, will do all it should according to its @property declarations. So if it is declared as retain, it will be correctly retained in its setter, without you having to worry about it.

    So, in conclusion, while the Apple code you mention may work correctly (I haven’t looked), it would be better defensive coding to use properties.

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

Sidebar

Ask A Question

Stats

  • Questions 141k
  • Answers 141k
  • 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 You try to cancat an ANSI string with a Unicode… May 12, 2026 at 8:04 am
  • Editorial Team
    Editorial Team added an answer If there is text entered is it safe to assume… May 12, 2026 at 8:04 am
  • Editorial Team
    Editorial Team added an answer That CSS works fine for me. Are you sure you… May 12, 2026 at 8:04 am

Related Questions

I have a View Controller I'm reusing to edit individual objects (NSString, NSNumber, NSDate)
I have a modal view controller that I put onto screen using presentModalViewController:animated .
I have a navigation controller and in it a view controller: -NavigationController1 --MyViewController And
Lets say I have a view, myView, a view controller, myViewController, and some sort
In my IB I have a navigation controller which has in it a view

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.