Tutorial details

Using a DatePicker | App Code for Sale | Preview

Using a DatePicker | iOS Tutorial

How to use the date picker and how to show its output in an alert view a label and textfield

Overview PAGE TOP

Reference: http://www.geekylemon.com/WEBPROTECT-xcodedatepicker.htm

In this tutorial i will be showing you how to use the date picker and how to show its output in an alert view a label and textfield.


  • 1 UIDatePicker
  • 1 Round Rect Button
  • 1 Label
  • 1 Textfield

Date pickers are great for choosing multiple options like date day time etc making displaying mass content easier

ViewController.h PAGE TOP

@interface ViewController :UIViewController {
    UIDatePicker *datepick;
IBOutlet UILabel *label;
IBOutlet UITextField *textfield;
@property (nonatomic, retain)IBOutlet
UIDatePicker *datepick;

ViewController.m PAGE TOP

@implementation ViewController
@synthesize datepick;
-(IBAction)button {
NSDate *choice = [datepick date];
NSString *words = [[NSString alloc]initWithFormat:@"The date is %@", choice];
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"the title" message:words
    delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil, nil];
    [alert show];
    [alert release];
    [words release];
label.text = words;
textfield.text = words;
- (void)dealloc
    [datepick release];
    [super dealloc];
- (void)viewDidUnload
self.datepick = nil;
    [super viewDidUnload];


Reference PAGE TOP


0 Comments Leave a comment

Please login in order to leave a comment.

Newest first

to your Chupamobile Account.

The Easiest way to Launch your next App or Game.

Join Chupamobile and get instant access to thousands of ready made App and Game Templates.

Creating an account means you’re okay with Chupamobile’s Terms of Service and Privacy Policy.