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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:47:50+00:00 2026-05-31T19:47:50+00:00

I have a navigation-based app and say my root controller A causes a viewController

  • 0

I have a navigation-based app and say my root controller A causes a viewController B to be pushed, which has a UITableView with a few cells with UITextFields.

The first 2 UITextFields have each, as their inputView, a UIDatePicker and a UIPickerView, respectively. Also, the UIPickerView has 4 components whose UIViews are returned through

- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 60, 37)];
    label.text = [NSString stringWithFormat:@"%@%i", ((component == 3) ? @"." : @""), row];
    label.textAlignment = UITextAlignmentCenter;
    label.font = [UIFont boldSystemFontOfSize:24];
    label.backgroundColor = [UIColor clearColor];
    [label autorelease];

    return label;
}

In vertical orientation, the UIPickerView looks like this:
enter image description here

What I’ve noticed is the following:

CASE 1 – CORRECT

  1. I’m in viewController A in vertical orientation.
  2. I rotate the device / simulator from a vertical orientation to horizontal orientation
  3. I push viewController B
  4. I cause the UIPickerView to pop up

The picker frame is correctly stretched to landscape mode and the component views are still the correct size and centered:

enter image description here

BUT

CASE 2 – INCORRECT

  1. I’m in viewController A in vertical orientation.
  2. I push viewController B
  3. I rotate the device / simulator from a vertical orientation to horizontal orientation
  4. I cause the UIPickerView to pop up

In this case, the UIPickerView’s components get messed up:

enter image description here

Any thoughts?

  • 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-31T19:47:52+00:00Added an answer on May 31, 2026 at 7:47 pm

    So I figured this much: Don’t know why, but essentially a call to -setNeedsLayout is missing for the input view when the device rotates.

    UIDatePicker (inputView = UIDatePicker) results in a picker that automatically (re) lays itself out to the right orientation, but UIPickerView (inputView = UIPickerView) does not.

    So it seems like UIPickerView might be not registering for orientation changes or something of the sort. Which I solved by registering it manually. That is, in my setup code I add:

    [[NSNotificationCenter defaultCenter] addObserver:weightPicker 
                                             selector:@selector(setNeedsLayout) 
                                                 name:UIDeviceOrientationDidChangeNotification   
                                                  object:nil];
    

    And now the picker behaves just fine.

    Also, remember to deregister with the NSNotificationCenter before the textField gets deallocated.

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

Sidebar

Related Questions

I have a navigation based app where a certain pushed view has a nice
I have a simple navigation based app which has a bunch fo forms in
I have a navigation controller-based app in which I would like to temporarily disable
I have a navigation based app. The screen List has a UITableView with a
I have an iPhone app that is based on a navigation controller. I have
I have a navigation controller which also has a table view. I want to
I am building a Calendar app. I have Navigation based app template. Navigation controller
I have a navigation controller based app, and added some toolbar items with code
I have a storyboard based app with a navigation controller as the initial view
I have a navigation based app. The root view is a list of items.

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.