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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T20:21:55+00:00 2026-05-12T20:21:55+00:00

What I would like to do is this: A UIPickerView is shown. If the

  • 0

What I would like to do is this:

A UIPickerView is shown. If the user touches the selected row, the row is locked (it is a multi-component picker) and the other components are free to spin. If the row has already been locked and the user touches the locked row, the row is then unlocked and free to spin. I have the locking part coded already using a button. I would like to remove the button and replace with the highlighted picker option.

I have tried:

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
}

Apparently this only fires if the row has not been selected already so when I touch a row that is in the highlighted region, this event does not fire.

I then tried

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
 NSLog(@"touchesBegan");
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
 NSLog(@"touchesMoved");
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
 NSLog(@"touchesEnded");
}

None of these events fire when the picker is touched.

Any ideas on how to detect when a highlighted/selected row in a picker is touched by the user?

  • 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-12T20:21:55+00:00Added an answer on May 12, 2026 at 8:21 pm

    Well — there is a simple workaround that did exactly what I wanted to accomplish. Basically I wanted to have the user tap the selection bar on a multicomponent picker view and have that component locked while the others are free to spin.

    Here is what I did:

    First – turn off the option to show the selection bar.

    Second – create three labels – one for each component — the labels are the same height and location as the selector bar, but there is one over each component. They but each other to appear to be a solid bar.

    Third – create a method to change the color of the label to indicate that it is locked to the user. I am also using a boolean flag to let the program processes know when a component is locked.

        - (IBAction) lockButtonPress:(id)sender {
    
        // determine which button was pressed....
        int btnPressed = 0;
        if (leftSelectionBar.touchInside) btnPressed = 1;
        if (centerSelectionBar.touchInside) btnPressed = 2;
        if (rightSelectionBar.touchInside) btnPressed = 3;
    
        // we are not going to make this difficult -- images for different states..... default in viewWillShow
        switch (btnPressed) {
            case 1:
                if (lockSelected0) {
                    lockSelected0 = FALSE;
                    [leftSelectionBar setBackgroundColor:[UIColor blueColor]];
                    [leftSelectionBar setAlpha:0.25];
                } else {
                    lockSelected0 = TRUE;
                    [leftSelectionBar setBackgroundColor:[UIColor redColor]];
                    [leftSelectionBar setAlpha:0.45];
    
                }
                break;
            case 2:
                if (lockSelected1) {
                    lockSelected1 = FALSE;
                    [centerSelectionBar setBackgroundColor:[UIColor blueColor]];
                    [centerSelectionBar setAlpha:0.25];
                } else {
                    lockSelected1 = TRUE;
                    [centerSelectionBar setBackgroundColor:[UIColor redColor]];
                    [centerSelectionBar setAlpha:0.45];
                }
                break;
            case 3:
                if (lockSelected2) {
                    lockSelected2 = FALSE;
                    [rightSelectionBar setBackgroundColor:[UIColor blueColor]];
                    [rightSelectionBar setAlpha:0.25];
                } else {
                    lockSelected2 = TRUE;
                    [rightSelectionBar setBackgroundColor:[UIColor redColor]];
                    [rightSelectionBar setAlpha:0.45];
                }
                break;
            default:
                break;
        }   
    }
    

    And that’s it…. simple 😉

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

Sidebar

Related Questions

I would like to match paths like /this/is/my/dir/name/anything but not /this/is/my/dir/name/anything/anything2 . In other
I would like this to be the ultimate discussion on how to check if
I would like to do something like this: a rotating cube on a form.
I would like to do something like this: container::iterator it = NULL; switch (
I would like to be able to achieve something like this: class Zot {
In C++0x I would like to write a function like this: template <typename... Types>
I am a little confused here. I would like to do something like this:
In Java, it would look like this: class Foo { float[] array; } Foo
I'm using SQL Server 2005. The query would look like this Select col1, col2,
I would like to replicate this in python: gvimdiff <(hg cat file.txt) file.txt (hg

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.