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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:23:43+00:00 2026-05-13T15:23:43+00:00

I have a view based application which has some textboxes that I’m trying to

  • 0

I have a view based application which has some textboxes that I’m trying to populate with some pickers. For example, one of them will be for date selection. I’m using the following to add a new view to the bottom of my current view, then scroll the entire view upwards:

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
  if(textField == [self date]) {        
    editingDate = YES;
    UIDatePicker *pv = [[UIDatePicker alloc] initWithFrame:CGRectMake(0,460,0,0)];
    pv.userInteractionEnabled = YES;
    [self.view addSubview:pv];  
    textField.placeholder = @"currently selecting below";   
    [self scrollTheView:YES];
    return NO;
  } 
  return YES;
}

My scrollTheView method executes as follows:

- (void)scrollTheView:(BOOL) moveUp {
    int scrollAmount = 212;
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.3];
    CGRect rect = self.view.frame;
    if(moveUp){
        rect.origin.y -= scrollAmount;
    }
    else {
        rect.origin.y += scrollAmount;
    }
    self.view.frame = rect;
    [UIView commitAnimations];
} 

My problem is that although the display looks perfect, the datepicker control will not accept my input at all. It is simply stuck on the current date. I’m not sure what I’m missing here, probably something simple.

  • 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-13T15:23:43+00:00Added an answer on May 13, 2026 at 3:23 pm

    By modifying the code above to do the following to add the subview as a subview of the superview:

        UIView *myView = [[UIView alloc] initWithFrame:CGRectMake(0, 480, 320, 216)];
        UIDatePicker *pv = [[UIDatePicker alloc] initWithFrame:CGRectMake(0,0,320,216)];
        [myView addSubview:pv];
    
        [self.view.superview addSubview:myView];  
    

    and modifying my scroll method to additionally scroll this new view:

        UIView *sv = self.view.superview;
        UIView *subv = [[sv subviews] objectAtIndex:1];
        CGRect rect2 = subv.frame;
        if(moveUp){
            rect2.origin.y -= scrollAmount;
        }
        else {
            rect2.origin.y += scrollAmount;
        }
        subv.frame = rect2;
    

    I was able to achieve the goal. Thanks to Ben for the assistance.

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

Sidebar

Ask A Question

Stats

  • Questions 288k
  • Answers 288k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Two options: Put Foo and Bar in a separate assembly,… May 13, 2026 at 5:25 pm
  • Editorial Team
    Editorial Team added an answer You could try to use if else and regex for… May 13, 2026 at 5:25 pm
  • Editorial Team
    Editorial Team added an answer Logically you'd want: [exact phrase] + 1 colon + 0… May 13, 2026 at 5:25 pm

Related Questions

I am working on a typical data entry system in Silverlight. Most of my
I am currently working on an iPhone 2.1 application. I am new to Objective
Can any one tell me how to solve the following scenario in Asp.net application.
I'm developing an asp.net application which has Windows Authentication enabled(anonymous access disabled). I've created
I'm experimenting with ViewControllers & NavigationControllers in Interface Builder trying to get a better

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.