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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:07:45+00:00 2026-06-18T12:07:45+00:00

Ok I am trying to replace the Keyboard with the UIpicker. I got the

  • 0

Ok I am trying to replace the Keyboard with the UIpicker. I got the code in, the Uipicker always show, and when you click on the text field of course the keyboard comes up….I even put break points in to see if it makes it to the code that tells it to hide the keyboard and it never does….Would someone look at it and see where i went wrong

 #import "collectionViewViewController.h"
#import "activityCell.h"

@interface collectionViewViewController ()
{
    NSArray *imageArray;
    NSArray *labelArray;
}

@end

@implementation collectionViewViewController
@synthesize pickerViewContainer;


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}



- (void)viewDidLoad
{
    [super viewDidLoad];

    //picker exists in the view, but is outside visible range
    UIPickerView *pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(200, 780, 400, 270)];
    pickerView.delegate = self;
    pickerView.showsSelectionIndicator = YES;
    [self.view addSubview:pickerView];



    [[self collectionView]setDataSource:self];
    [[self collectionView]setDelegate:self];

    imageArray = [[NSArray alloc]initWithObjects:
        @"act_blank.png",
        @"act_blank.png",
       @"act_blank.png",
       @"act_blank.png",
       @"act_blank.png",
        @"act_blank.png",
        @"act_1.png",
        @"act_2.png",
        @"act_3.png",
        @"act_4.png",
        @"act_5.png",
        @"act_6.png",
        @"act_7.png",
        @"act_8.png",
        @"act_9.png",
        @"act_10.png",
        @"act_11.png",
        @"act_12.png",
        @"act_13.png",
        @"act_14.png",
        @"act_15.png",
        @"act_16.png",
        @"act_17.png",
        @"act_18.png",nil];

    [[self pickerView]setDataSource:self];
    [[self pickerView]setDelegate:self];


    arrayHour = [[NSMutableArray alloc] init];
    [arrayHour addObject:@"0 h"];
    [arrayHour addObject:@"1 h"];
    [arrayHour addObject:@"2 h"];
    [arrayHour addObject:@"3 h"];
    [arrayHour addObject:@"4 h"];
    [arrayHour addObject:@"5 h"];
    [arrayHour addObject:@"6 h"];
    [arrayHour addObject:@"7 h"];
    [arrayHour addObject:@"8 h"];

    arrayMinute = [[NSMutableArray alloc] init];
    [arrayMinute addObject:@"0 min"];
    [arrayMinute addObject:@"15 min"];
    [arrayMinute addObject:@"30 min"];
    [arrayMinute addObject:@"45 min"];
    pickerViewContainer.hidden = YES;


    //labelArray = [[NSArray alloc] initWithObjects:@"1st",@"2nd", nil];

    // Do any additional setup after loading the view.
}

//animate the picker into view
- (void)textFieldDidEndEditing:(UITextField *)textField {

    [UIView beginAnimations:@"picker" context:nil];
    [UIView setAnimationDuration:0.5];

    _pickerView.transform = CGAffineTransformMakeTranslation(0,-236);
    [UIView commitAnimations];

}

//animate the picker out of view
- (void)textFieldDidBeginEditing:(UITextField *)textField {

    [UIView beginAnimations:@"picker" context:nil];
    [UIView setAnimationDuration:0.5];

    _pickerView.transform = CGAffineTransformMakeTranslation(0,236);
    [UIView commitAnimations];
}

//just hide the keyboard in this example
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField resignFirstResponder];
    return NO;
}


-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectioinView
{
    return 1;
}

-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return [imageArray count];
}

-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath 
{
    static NSString *CellIdentifier=@"cell";
    activityCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
    [[cell imageView]setImage:[UIImage imageNamed:[imageArray objectAtIndex:indexPath.item]]];

      UITextField *nameLabel = (UITextField *)[cell viewWithTag:1];

    nameLabel.text = @"HERRO";
    //[[cell textField]setText:[labelArray objectAtIndex:indexPath.item]];

    return cell;




}



- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)thePickerView
{

    return 2;

}

- (NSInteger)pickerView:(UIPickerView *)thePickerView numberOfRowsInComponent:(NSInteger)component {
    if (component == HOUR)
        return [arrayHour count];
    if (component == Minutes)
        return [arrayMinute count];


    return 0;
}

- (NSString *)pickerView:(UIPickerView *)thePickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component{


    if (component == HOUR)
        return [arrayHour objectAtIndex:row];
    if (component == Minutes)
        return [arrayMinute objectAtIndex:row];


    return 0;
}

-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
//    static NSString *CellIdentifier=@"cell";
//    
//    activityCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
//
//    
//    
//    UITextField *nameLabel = (UITextField *)[cell viewWithTag:1];


    //nameLabel.text = [NSString stringWithFormat:@"%@  %@",[arrayHour objectAtIndex:[pickerView selectedRowInComponent:0]], [arrayMinute objectAtIndex:[pickerView    selectedRowInComponent:1]]];


    //textLabel.text = [NSString stringWithFormat:@"%@  %@",[arrayHour objectAtIndex:[pickerView selectedRowInComponent:0]], [arrayMinute objectAtIndex:[pickerView    selectedRowInComponent:1]]];


    //[[cell textField]setText:[labelArray objectAtIndex:indexPath.item]];
    //textField.text = [NSString stringWithFormat:@"%@  %@",[arrayHour objectAtIndex:[pickerView selectedRowInComponent:0]], [arrayMinute objectAtIndex:[pickerView    selectedRowInComponent:1]]];


    return 0;
}




- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewDidUnload {
    [self setCollectionView:nil];
    [self setPickerView:nil];
    [self setPickerViewContainer:nil];
    [self setTimeText:nil];
    collectionView = nil;
    [super viewDidUnload];
}
- (IBAction)closePicker:(id)sender {
    pickerViewContainer.hidden = YES;
}

- (IBAction)showPicker:(id)sender {
    pickerViewContainer.hidden = NO;
}
@end

THanks

  • 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-06-18T12:07:46+00:00Added an answer on June 18, 2026 at 12:07 pm

    You’re not overriding the right delegate method:

    - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
        <code that presentes the picker view>
        return NO;
    }
    

    That should stop the text field from showing the keyboard, and instead do whatever you want.

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

Sidebar

Related Questions

I'm trying to replace text by html tags. I'm using this code: $('p').each(function ()
I'm trying to replace the zoom functionality with scroll on my microsoft ergonomic keyboard
I have been trying to replace a word in a text file with a
Im trying to replace the html of emoticon (the image) in to plain text.
I am trying to replace the HTML code with a heredoc statement. However, I
I am trying replace a backslash '\' in a string with the following code
I am trying to replace some text in a file replacetest.xml here is the
Trying to replace this jquery code with some php server side magic: $(document).ready(function() {
Just trying to replace the hyperlink text and I'm not finding a way to
I'm currently trying to replace a piece of plain text in a page that

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.