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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:45:55+00:00 2026-05-11T01:45:55+00:00

I have a UIPickerView as subview in a UITableViewController, which I want to slide

  • 0

I have a UIPickerView as subview in a UITableViewController, which I want to slide up in place when a certain row is clicked. I have implemented the necessary dataSource and delegate methods, but the pickerview acts weirdly. It acts as if it were mechanically jammed, it cannot rotate properly, it just moves a little. If I try to spin it a few times I get this message in the debugger console:

SendDelegateMessage: delegate failed to return after waiting 10 seconds. main run loop mode: UITrackingRunLoopMode If you were not using the touch screen for this entire interval (which can prolong this wait), please file a bug.

I googled for this, to no avail. Anyway, here is the relevant code. As you may guess, this is a number picker (to choose a percentage value).

- (void)viewDidLoad {      [super viewDidLoad];      percentPicker  = [[UIPickerViewalloc] initWithFrame:CGRectMake(0,420, 320, 200)];      percentPicker.delegate = self;      percentPicker.dataSource = self;      percentPicker.showsSelectionIndicator = YES;      [self.view addSubview:percentPicker];  }  - (void)viewWillAppear:(BOOL)animated {      // sets the rows to the appropriate value      // etc }  - (void)startEditingPercentage {      [UIView beginAnimations :nilcontext:NULL];      [UIView setAnimationBeginsFromCurrentState:YES];      [UIViewsetAnimationDuration:kPickerAnimationDuration ];      percentPicker.transform = CGAffineTransformTranslate(CGAffineTransformIdentity, 0, -220.0);      [UIViewcommitAnimations];  }  - (void)stopEditingPercentage {     NSLog(@'stopEditingPercentage');     [UIView beginAnimations :nilcontext:NULL];     [UIViewsetAnimationBeginsFromCurrentState:YES];     [UIViewsetAnimationDuration:kPickerAnimationDuration];     percentPicker.transform = CGAffineTransformIdentity;     [UIView commitAnimations]; }  #pragma mark UIPickerView delegate and dataSource methods  - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {     return4; }  - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {     return10; }  - (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component {      return44; }  - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view {     UILabel *retval = (UILabel *)view;     if (!retval) {         retval= [[UILabel newLabelWithPrimaryColor :[UIColorblackColor ] selectedColor:[ UIColor blackColor] fontSize:22bold:YEStransparent:YES] autorelease];     }     retval.frame = CGRectMake(0, 0, 44, 44);     retval.textAlignment = UITextAlignmentCenter;     retval.backgroundColor = [UIColor clearColor];     retval.text = [NSStringstringWithFormat:@'%i', row];     if (component > 1 ) {         // rows 2 and 3 are decimal, white on black         retval.backgroundColor = [UIColor blackColor];         retval.textColor = [UIColor whiteColor];     }     return retval; }  - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {     NSString *selectedValue;     selectedValue= [NSString stringWithFormat:@'%i%i.%i%i' ,[percentPickerselectedRowInComponent :0], [ percentPickerselectedRowInComponent: 1], [percentPickerselectedRowInComponent:2], [percentPickerselectedRowInComponent:3]];     NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];     NSString *trimmedValue = [[formatter numberFromString:selectedValue] stringValue];     percentValue.text = trimmedValue;     [formatter release]; } 

As you see, I use the transform property to move the picker in and out (down) my main view; the startEditing and stopEditing methods are triggered by selection in the teble view. Yet, for the debugging purposes, I eliminated these transitions , and left the picker on top of the table, but nothing changed. I also commented the didSelect method, but this also didn’t change anything. By the way, the same picker-view construction code vorkw allright in another view of the same app. Any suggestion? Cheers,

  • 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-11T01:45:55+00:00Added an answer on May 11, 2026 at 1:45 am

    You aren’t really adding the picker to UITableView using the code in viewDidLoad. UITableView can only have controls/rows in UITableViewCells and these are specified in the cellForRowAtIndex method. We cannot add controls to UITableView like we do to UIView.

    Try using a subclass of UIView instead and add the UITableView and the picker to this UIView subclass.

    In case you want to use a UITableViewController subclass only, create a custom cell and add the picker to this custom cell. But then you won’t be able to hide/unhide this cell if you add it statically. Then you’ll have to use reloadData. I would suggest using the UIView subclass.

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

Sidebar

Ask A Question

Stats

  • Questions 79k
  • Answers 79k
  • 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 Generally, how it works is, you add an Image to… May 11, 2026 at 4:05 pm
  • Editorial Team
    Editorial Team added an answer When you lifted that code from here :-), you renamed… May 11, 2026 at 4:05 pm
  • Editorial Team
    Editorial Team added an answer Is there any way to do the same thing with… May 11, 2026 at 4:05 pm

Related Questions

I have the following code to create a UIPickerView: pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0.0f,
I would like to show a set of consecutive numbers in a UIPickerView component
I have read several of the post about Objective-C method syntax but I guess
Im using a navigation controller and a normal view. In the view I'd like

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.