-(void)ActionsheetClick:(id)sender{
UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@"Date Picker"
delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil
otherButtonTitles:nil];
// Add the picker
UIdatepicker *picker = [[UIDatePicker alloc] init];
picker.datePickerMode = UIDatePickerModeDate;
[menu addSubview:picker];
[menu showInView:self.view];
[menu setBounds:CGRectMake(0,0,320, 500)];
CGRect pickerRect = picker.bounds;
pickerRect.origin.y = -100;
picker.bounds = pickerRect;
}
// Action sheet delegate method......
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
NSDate *dat = [picker date];
NSDateFormatter *df = [[NSDateFormatter alloc]init];
[df setDateFormat:@"dd MM yyyy HH:mm"];
NSString *strr =[df stringFromDate:dat];
txt.text = strr;
}
UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@"Date Picker"
delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil
otherButtonTitles:nil];
// Add the picker
UIdatepicker *picker = [[UIDatePicker alloc] init];
picker.datePickerMode = UIDatePickerModeDate;
[menu addSubview:picker];
[menu showInView:self.view];
[menu setBounds:CGRectMake(0,0,320, 500)];
CGRect pickerRect = picker.bounds;
pickerRect.origin.y = -100;
picker.bounds = pickerRect;
}
// Action sheet delegate method......
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
NSDate *dat = [picker date];
NSDateFormatter *df = [[NSDateFormatter alloc]init];
[df setDateFormat:@"dd MM yyyy HH:mm"];
NSString *strr =[df stringFromDate:dat];
txt.text = strr;
}