iPhone控件之UIDatePicker

#import "UITestViewController.h"

@implementation UITestViewController

- (void)pickerChanged:(id)sender
{
NSLog(@"value: %@",[sender date]);
}

- (void)viewDidLoad {

[super viewDidLoad];

CGRect pickerFrame = CGRectMake(0,120,0,0);

UIDatePicker *myPicker = [[UIDatePicker alloc] initWithFrame:pickerFrame];
[myPicker addTarget:self action:@selector(pickerChanged:) forControlEvents:UIControlEventValueChanged];

[self.view addSubview:myPicker];

[myPicker release];
}
posted @ 2012-03-13 12:59  FoxBabe  阅读(306)  评论(0编辑  收藏  举报