文件名称:时间选择器
文件大小:67KB
文件格式:ZIP
更新时间:2019-05-07 03:09:00
UIpickerVeiw
根据网上代码重新整合了一下,将取消和确定按钮封装进去,可以根据自己的需求修改时间格式,欢迎各位大神进一步优化。 - (void)viewDidLoad { [super viewDidLoad]; _textField.delegate = self; _cuiPickerView = [[CuiPickerView alloc]init]; _cuiPickerView.frame = CGRectMake(0, self.view.frame.size.height, self.view.frame.size.width, 200); //这一步很重要 _cuiPickerView.myTextField = _textField; _cuiPickerView.delegate = self; _cuiPickerView.curDate=[NSDate date]; [self.view addSubview:_cuiPickerView]; } //开始编辑 -(void)textFieldDidBeginEditing:(UITextField *)textField { textField.inputView = [[UIView alloc]initWithFrame:CGRectZero]; [_cuiPickerView showInView:self.view]; } //赋值给textField -(void)didFinishPickView:(NSString *)date { self.dataString = date; _textField.text = date; }
【文件预览】:
ChooseTime
----.git()
--------index(2KB)
--------hooks()
--------config(144B)
--------description(73B)
--------refs()
--------logs()
--------objects()
--------info()
--------COMMIT_EDITMSG(15B)
--------HEAD(23B)
----ChooseTimeTests()
--------ChooseTimeTests.m(903B)
--------Info.plist(733B)
----ChooseTime.xcodeproj()
--------project.xcworkspace()
--------project.pbxproj(20KB)
--------xcuserdata()
----ChooseTime()
--------Assets.xcassets()
--------main.m(329B)
--------CuiPickerView.h(622B)
--------AppDelegate.h(272B)
--------AppDelegate.m(2KB)
--------Base.lproj()
--------CuiPickerView.m(11KB)
--------ViewController.h(210B)
--------Info.plist(1KB)
--------ViewController.m(1KB)
----ChooseTimeUITests()
--------Info.plist(733B)
--------ChooseTimeUITests.m(1KB)