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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:25:32+00:00 2026-05-27T03:25:32+00:00

Im using a UIDatePicker on ModeTime, but is very slow?? here the code: #import

  • 0

Im using a UIDatePicker on ModeTime,

but is very slow??

here the code:

#import "U2YAccountController.h"

@implementation U2YAccountController
@synthesize timePicker = _timePicker;
@synthesize timeLabel= _timeLabel;  
@synthesize scheduleLabel = _scheduleLabel;

- (id)init
{
self = [super init];
if (self) {
    // Set title
    self.title = @"Reminder Settings"; 


    CGRect dosageImageRect = CGRectMake(10, 30, 300, 62);
    UIImageView *dosageImage = [[UIImageView alloc] initWithFrame:dosageImageRect];
    [dosageImage setImage:[UIImage imageNamed:@"dosageReminderButton.png"]]; //image was a button, now just image change name of png!
    dosageImage.opaque = YES; // explicitly opaque for performance
    [self.view addSubview:dosageImage];
    [dosageImage release];




    UIButton *timeReminderButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [timeReminderButton setImage:[UIImage imageNamed:@"reminderTimeButton.png"] forState:UIControlStateNormal]; 
    [timeReminderButton setFrame:CGRectMake(10, 110, 300, 44)];
    [timeReminderButton addTarget:self action:@selector(timeReminderButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
    [timeReminderButton setAdjustsImageWhenHighlighted:NO];
    [self.view addSubview:timeReminderButton];


    self.timePicker = [[[UIDatePicker alloc] initWithFrame:CGRectMake(0, 415, 220, 180)]autorelease];
    self.timePicker.datePickerMode = UIDatePickerModeTime;
    [self.timePicker addTarget:self action:@selector(timePickerChanged:) forControlEvents:UIControlEventValueChanged];
    [self.view addSubview:self.timePicker];
    //[self.timePicker setHidden:YES];

    self.scheduleLabel = [[[UILabel alloc]initWithFrame:CGRectMake(22, 64, 200, 20)]autorelease];
    self.scheduleLabel.textColor = [UIColor colorWithRed:12/255.0 green:113/255.0 blue:186/255.0 alpha:1];
    self.scheduleLabel.text = @"Schedule 6 of 7 days";  //updated from web site!!
    [self.view addSubview:self.scheduleLabel];

    self.timeLabel = [[[UILabel alloc]initWithFrame:CGRectMake(213, 122, 80, 20)]autorelease];
    self.timeLabel.textColor = [UIColor colorWithRed:12/255.0 green:113/255.0 blue:186/255.0 alpha:1];
    self.timeLabel.backgroundColor = [UIColor clearColor];
    self.timeLabel.text = @"";
    [self.view addSubview:self.timeLabel];


    dateFormat = [[NSDateFormatter alloc] init];
    [dateFormat setDateFormat:@"hh:mma"];

}
return self;
}


 - (void) timeReminderButtonPressed :(id) sender {


recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(viewTapped:)] ;


[UIView beginAnimations:@"PickerUp" context:nil];
[UIView setAnimationDuration:0.3f];
[UIView setAnimationBeginsFromCurrentState:YES];

self.timePicker.frame = CGRectMake(0, 237, 320, 180);

[self.view addGestureRecognizer:recognizer];

[recognizer release];



}

- (void) timePickerChanged:(id) sender {


today = [sender date];


NSString *dateString = [dateFormat stringFromDate:today];

self.timeLabel.text = dateString;


}

- (void) viewTapped :(id) sender {
[UIView beginAnimations:@"PickerDown" context:nil];
[UIView setAnimationDuration:0.3f];
[UIView setAnimationBeginsFromCurrentState:YES];

self.timePicker.frame = CGRectMake(0, 415, 320, 180);

[self.view removeGestureRecognizer:recognizer];

}


- (void) dealloc {

[dateFormat release];


[_scheduleLabel release];
[_timeLabel release];
[_timePicker release];
[super dealloc];
}

@end

So why is my picker slow and getting stucked?
what im i missing??

ps. I have commented the nsDateFormatter to find if that was the problem, but no change…

thanks a lot!

  • 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-27T03:25:32+00:00Added an answer on May 27, 2026 at 3:25 am

    Another thing to add to previous answer is that you’ve forgot to commit your animation. I’ll even suggest you to use animateWith… methods of the UIView class rather than beginAnimation/commitAnimation as it should be faster (at least by apple).
    And one more to go. The gesture recognizer… why not create it with the view at the init time? why create it every time you call the picker?

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

Sidebar

Related Questions

i am using the Code example from Apple, to display a UIDatePicker when a
I have just started using UIDatePicker in my iPad app, but is there a
I just added a UIDatePicker to my iPad app using IB, linked it to
I am using UIDatePicker controller to choose the date in iPhone app. Now, i
I am using an UIDatePicker in my application. When the application loads up, the
When using a UIDatePicker in iOS SDK, there is always an entry Today at
I am using UIDatePicker in my iPhone application.I have kept a button on clicking
I am using UIDatePicker in my app and when i take the date that
I am using JQuery's UI datepicker: http://jqueryui.com/demos/datepicker/ implemented here: http://www.clients.eirestudio.net/old/ I want to use
I'm trying to combine some options of jQuery UI Datepicker I'm using the code

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.