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 170441

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:48:31+00:00 2026-05-11T12:48:31+00:00

In the clocks application, the timer screen shows a picker (probably a UIPicker in

  • 0

In the clocks application, the timer screen shows a picker (probably a UIPicker in UIDatePickerModeCountDownTimer mode) with some text in the selection bar (‘hours’ and ‘mins’ in this case).

(edit) Note that these labels are fixed: They don’t move when the picker wheel is rolling.

Is there a way to show such fixed labels in the selection bar of a standard UIPickerView component?

I did not find any API that would help with that. A suggestion was to add a UILabel as a subview of the picker, but that didn’t work.


Answer

I followed Ed Marty’s advice (answer below), and it works! Not perfect but it should fool people. For reference, here’s my implementation, feel free to make it better…

- (void)viewDidLoad {     // Add pickerView     self.pickerView = [[UIPickerView alloc] initWithFrame:CGRectZero];     [pickerView release];     CGSize pickerSize = [pickerView sizeThatFits:CGSizeZero];     CGRect screenRect = [[UIScreen mainScreen] applicationFrame];     #define toolbarHeight           40.0     CGFloat pickerTop = screenRect.size.height - toolbarHeight - pickerSize.height;     CGRect pickerRect = CGRectMake(0.0, pickerTop, pickerSize.width, pickerSize.height);     pickerView.frame = pickerRect;      // Add label on top of pickerView     CGFloat top = pickerTop + 2;     CGFloat height = pickerSize.height - 2;     [self addPickerLabel:@'x' rightX:123.0 top:top height:height];     [self addPickerLabel:@'y' rightX:183.0 top:top height:height];     //... }  - (void)addPickerLabel:(NSString *)labelString rightX:(CGFloat)rightX top:(CGFloat)top height:(CGFloat)height { #define PICKER_LABEL_FONT_SIZE 18 #define PICKER_LABEL_ALPHA 0.7     UIFont *font = [UIFont boldSystemFontOfSize:PICKER_LABEL_FONT_SIZE];     CGFloat x = rightX - [labelString sizeWithFont:font].width;      // White label 1 pixel below, to simulate embossing.     UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(x, top + 1, rightX, height)];     label.text = labelString;     label.font = font;     label.textColor = [UIColor whiteColor];     label.backgroundColor = [UIColor clearColor];     label.opaque = NO;     label.alpha = PICKER_LABEL_ALPHA;     [self.view addSubview:label];     [label release];      // Actual label.     label = [[UILabel alloc] initWithFrame:CGRectMake(x, top, rightX, height)];     label.text = labelString;     label.font = font;     label.backgroundColor = [UIColor clearColor];     label.opaque = NO;     label.alpha = PICKER_LABEL_ALPHA;     [self.view addSubview:label];     [label release]; } 
  • 0 0 Answers
  • 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-11T12:48:32+00:00Added an answer on May 11, 2026 at 12:48 pm

    Create your picker, create a label with a shadow, and push it to a picker’s subview below the selectionIndicator view.

    It would look something like this

     UILabel *label = [[[UILabel alloc] initWithFrame:CGRectMake(135, 93, 80, 30)] autorelease]; label.text = @'Label'; label.font = [UIFont boldSystemFontOfSize:20]; label.backgroundColor = [UIColor clearColor]; label.shadowColor = [UIColor whiteColor]; label.shadowOffset = CGSizeMake (0,1); [picker insertSubview:label aboveSubview:[picker.subviews objectAtIndex:5]];  //When you have multiple components (sections)... //you will need to find which subview you need to actually get under //so experiment with that 'objectAtIndex:5' // //you can do something like the following to find the view to get on top of // define @class UIPickerTable; // NSMutableArray *tables = [[NSMutableArray alloc] init]; // for (id i in picker.subviews) if([i isKindOfClass:[UIPickerTable class]]) [tables addObject:i]; // etc...  

    — Pay it forward

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

Sidebar

Ask A Question

Stats

  • Questions 156k
  • Answers 156k
  • 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 This should get you started. There are some problems here,… May 12, 2026 at 10:54 am
  • Editorial Team
    Editorial Team added an answer According to the commons-logging docs, you should be able to… May 12, 2026 at 10:54 am
  • Editorial Team
    Editorial Team added an answer I must be missing something, but why not use a… May 12, 2026 at 10:54 am

Related Questions

I'm a Flex rookie tasked with enhancing an existing application. One of those enhancements
I would like to place some large items in the XP system tray. (the
Following recent hardware problems, I attempted to switch a couple of our websites to
I would like to show a set of consecutive numbers in a UIPickerView component

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.