IPhoneAt the bottom of the InstanceTimeSelector is the content to be introduced in this article. We useIphone controlsWhen implementing form forms, you sometimes need to addTime ControlThe general method is to add a button, click the button to appear from the bottomTimeSelector. For example:
Implementation Code:
- #import "iphone_datapicketViewController.h"
- @implementation iphone_datapicketViewController
- @synthesize myDatePicker,myView;
- - (void)viewDidLoad {
- [super viewDidLoad];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- }
- - (void)viewDidUnload {
- self.myDatePicker =nil;
- self.myView=nil;
- }
- - (void)dealloc {
- [self.myDatePicker release];
- [self.myView release];
- [super dealloc];
- }
- -(IBAction)onClickButton:(id)sender
- {
- [self showDatePick];
- }
- -(IBAction)onClickCloseButton:(id)sender
- {
- [self dissDatePick];
- }
- -(void)showDatePick
- {
- if (self.myView.superview == nil)
- {
- [self.view.window addSubview: self.myView];
- }
- CGRect screenRect = [[UIScreen mainScreen] applicationFrame];
- CGSize pickerSize = [self.myView sizeThatFits:CGSizeZero];
- CGRect startRect = CGRectMake(0.0,
- screenRect.origin.y + screenRect.size.height,
- pickerSize.width, pickerSize.height);
- self.myView.frame = startRect;
- CGRect pickerRect = CGRectMake(0.0,
- screenRect.origin.y + screenRect.size.height – pickerSize.height,
- pickerSize.width,
- pickerSize.height);
- [UIView beginAnimations:nil context:NULL];
- [UIView setAnimationDuration:0.3];
- [UIView setAnimationDelegate:self];
- self.myView.frame = pickerRect;
- CGRect newFrame = self.view.frame;
- newFrame.size.height -= self.myView.frame.size.height;
- self.view.frame = newFrame;
- [UIView commitAnimations];
- }
- -(void)dissDatePick
- {
- CGRect screenRect = [[UIScreen mainScreen] applicationFrame];
- CGRect endFrame = self.myView.frame;
- endFrame.origin.y = screenRect.origin.y + screenRect.size.height;
- [UIView beginAnimations:nil context:NULL];
- [UIView setAnimationDuration:0.3];
- [UIView setAnimationDelegate:self];
- self.myView.frame = endFrame;
- [UIView commitAnimations];
- CGRect newFrame = self.view.frame;
- newFrame.size.height += self.myView.frame.size.height;
- self.view.frame = newFrame;
- }
- @end
Also, use ib to createWidgetAnd connected.
Source code: http://easymorse-iphone.googlecode.com/svn/trunk/iphone.datapicket/
Summary:IPhoneAt the bottom of the InstanceTimeThe selector has been introduced. I hope this article will help you!