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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:01:41+00:00 2026-06-18T10:01:41+00:00

Possible Duplicate: UIDatePicker set Maximum date I am using this code to block the

  • 0

Possible Duplicate:
UIDatePicker set Maximum date

I am using this code to block the user from going over the limit I set:

in view did load:

NSDate *Date=[NSDate date];
[DatePickerForDate setMinimumDate:Date];
[DatePickerForDate setMaximumDate:[Date dateByAddingTimeInterval: 63072000]]; //time interval in seconds

And this method:

- (IBAction)datePickerChanged:(id)sender{
// When `setDate:` is called, if the passed date argument exactly matches the Picker's date property's value, the Picker will do nothing. So, offset the passed date argument by one second, ensuring the Picker scrolls every time.
NSDate* oneSecondAfterPickersDate = [DatePickerForDate.date dateByAddingTimeInterval:1] ;
if ( [DatePickerForDate.date compare:DatePickerForDate.minimumDate] == NSOrderedSame ) {
    NSLog(@"date is at or below the minimum") ;
    DatePickerForDate.date = oneSecondAfterPickersDate ;
}
else if ( [DatePickerForDate.date compare:DatePickerForDate.maximumDate] == NSOrderedSame   ) {
    NSLog(@"date is at or above the maximum") ;
    DatePickerForDate.date = oneSecondAfterPickersDate ;
}
}

The code in the if statements is never called. Why?

  • 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-18T10:01:42+00:00Added an answer on June 18, 2026 at 10:01 am

    Don’t you want to finish our discussion over here?

    First, make sure the datePickerChanged is being called when DatePickerForDate’s value is changed.

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

Sidebar

Related Questions

Possible Duplicate: NSDateComponents of an NSDate I have set up two UIDatePicker s in
Possible Duplicate: Subtract days from a date in javascript I have got a JavaScript
Possible Duplicate: Getting date from [NSDate date] off by a few hours NSDate date
Possible Duplicate: Variable doesn’t get returned from AJAX function I have this function: function
Possible Duplicate: Using -setImage on NSButton I created a button using following code .
Possible Duplicate: How do I make a request using HTTP basic authentication with PHP
Possible Duplicate: && operator in Javascript In the sample code of the ExtJS web
Possible Duplicate: How can I understand nested ?: operators in PHP? Why does this:
Possible Duplicate: Can main function call itself in C++? I found this problem very
Possible Duplicate: Can you write object oriented code in C? Hi, can someone point

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.