循环定时器相关逻辑
This commit is contained in:
@@ -15,10 +15,10 @@
|
||||
self=[super initWithFrame:frame];
|
||||
if (self) {
|
||||
|
||||
CGFloat imgWid= kScreenSize.width - 40*2;
|
||||
CGFloat imgWid= kScreenSize.width - 10*2;
|
||||
CGFloat imHeight= kScreenSize.width - 60;
|
||||
self.backgroundColor=[UIColor colorWithWhite:0 alpha:0.5];
|
||||
_backgroundImage=[[UIImageView alloc]initWithFrame:CGRectMake(40,kScreenSize.height/2-(kScreenSize.width -30)/2, imgWid, imHeight)];
|
||||
_backgroundImage=[[UIImageView alloc]initWithFrame:CGRectMake(10,kScreenSize.height/2-(kScreenSize.width -30)/2, imgWid, imHeight)];
|
||||
|
||||
_backgroundImage.image=[UIImage imageNamed:@"Box"];
|
||||
_backgroundImage.userInteractionEnabled=YES;
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
_startLabel=[[UILabel alloc] initWithFrame:CGRectMake(10,title.frame.size.height+20, _backgroundImage.frame.size.width/2, 20)];
|
||||
_startLabel.text=@"开始时间";
|
||||
|
||||
_startLabel.font=[UIFont systemFontOfSize:15];
|
||||
_startLabel.textAlignment=NSTextAlignmentCenter;
|
||||
[_backgroundImage addSubview:_startLabel];
|
||||
@@ -44,7 +45,7 @@
|
||||
[_backgroundImage addSubview:_endLabel];
|
||||
_startString = _startString1 =_startSecondString= _endString = _endString1 = _endSecondString= @"00";
|
||||
|
||||
_picView=[[UIPickerView alloc]initWithFrame:CGRectMake(10,_startLabel.frame.origin.y + 20,imgWid - 20,imHeight -30 - 40- 20)];
|
||||
_picView=[[UIPickerView alloc]initWithFrame:CGRectMake(0,_startLabel.frame.origin.y + 20,imgWid,imHeight -30 - 40- 20)];
|
||||
_picView.dataSource=self;
|
||||
_picView.delegate=self;
|
||||
|
||||
@@ -53,7 +54,7 @@
|
||||
|
||||
_cancleButton=[UIButton buttonWithType:UIButtonTypeCustom];
|
||||
_cancleButton.backgroundColor=[UIColor lightGrayColor];
|
||||
CGFloat wdspace=40;
|
||||
CGFloat wdspace=10;
|
||||
|
||||
_sureButton
|
||||
=[UIButton buttonWithType:UIButtonTypeCustom];
|
||||
@@ -105,28 +106,72 @@
|
||||
}
|
||||
|
||||
- (void)setPickerType:(NSString *)pickerType {
|
||||
|
||||
_pickerType = pickerType;
|
||||
UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(12,_startLabel.frame.origin.y+30, _picView.frame.size.width/4, 20)];
|
||||
label1.text=@"小时";
|
||||
label1.font=[UIFont systemFontOfSize:15];
|
||||
label1.textAlignment=NSTextAlignmentCenter;
|
||||
[_backgroundImage addSubview:label1];
|
||||
UILabel *label2 = [[UILabel alloc] initWithFrame:CGRectMake(12+label1.frame.size.width+2,_startLabel.frame.origin.y+30, _picView.frame.size.width/4, 20)];
|
||||
label2.text=@"分钟";
|
||||
label2.font=[UIFont systemFontOfSize:15];
|
||||
label2.textAlignment=NSTextAlignmentCenter;
|
||||
[_backgroundImage addSubview:label2];
|
||||
UILabel *label3 = [[UILabel alloc] initWithFrame:CGRectMake(label2.frame.origin.x+label2.frame.size.width+ 4,_startLabel.frame.origin.y+30, _picView.frame.size.width/4, 20)];
|
||||
label3.text=@"小时";
|
||||
label3.font=[UIFont systemFontOfSize:15];
|
||||
label3.textAlignment=NSTextAlignmentCenter;
|
||||
[_backgroundImage addSubview:label3];
|
||||
UILabel *label4 = [[UILabel alloc] initWithFrame:CGRectMake(label3.frame.origin.x+label3.frame.size.width+2,_startLabel.frame.origin.y+30, _picView.frame.size.width/4, 20)];
|
||||
label4.text=@"分钟";
|
||||
label4.font=[UIFont systemFontOfSize:15];
|
||||
label4.textAlignment=NSTextAlignmentCenter;
|
||||
[_backgroundImage addSubview:label4];
|
||||
[self initData];
|
||||
if ([self.pickerType isEqualToString:@"xuanduo"])
|
||||
{
|
||||
UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(12,_startLabel.frame.origin.y+30, _picView.frame.size.width/4, 20)];
|
||||
label1.text=@"小时";
|
||||
label1.font=[UIFont systemFontOfSize:15];
|
||||
label1.textAlignment=NSTextAlignmentCenter;
|
||||
[_backgroundImage addSubview:label1];
|
||||
UILabel *label2 = [[UILabel alloc] initWithFrame:CGRectMake(12+label1.frame.size.width+2,_startLabel.frame.origin.y+30, _picView.frame.size.width/4, 20)];
|
||||
label2.text=@"分钟";
|
||||
label2.font=[UIFont systemFontOfSize:15];
|
||||
label2.textAlignment=NSTextAlignmentCenter;
|
||||
[_backgroundImage addSubview:label2];
|
||||
UILabel *label3 = [[UILabel alloc] initWithFrame:CGRectMake(label2.frame.origin.x+label2.frame.size.width+ 4,_startLabel.frame.origin.y+30, _picView.frame.size.width/4, 20)];
|
||||
label3.text=@"小时";
|
||||
label3.font=[UIFont systemFontOfSize:15];
|
||||
label3.textAlignment=NSTextAlignmentCenter;
|
||||
[_backgroundImage addSubview:label3];
|
||||
UILabel *label4 = [[UILabel alloc] initWithFrame:CGRectMake(label3.frame.origin.x+label3.frame.size.width+2,_startLabel.frame.origin.y+30, _picView.frame.size.width/4, 20)];
|
||||
label4.text=@"分钟";
|
||||
label4.font=[UIFont systemFontOfSize:15];
|
||||
label4.textAlignment=NSTextAlignmentCenter;
|
||||
[_backgroundImage addSubview:label4];
|
||||
}
|
||||
else
|
||||
{
|
||||
_startLabel.text=@"开启时间";
|
||||
_endLabel.text=@"关闭时间";
|
||||
[_cancleButton setTitle:@"取消" forState:UIControlStateNormal];
|
||||
UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(12,_startLabel.frame.origin.y+30, _picView.frame.size.width/6, 20)];
|
||||
label1.text=@"时";
|
||||
label1.font=[UIFont systemFontOfSize:15];
|
||||
label1.textAlignment=NSTextAlignmentCenter;
|
||||
[_backgroundImage addSubview:label1];
|
||||
UILabel *label2 = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(label1.frame),_startLabel.frame.origin.y+30, _picView.frame.size.width/6, 20)];
|
||||
label2.text=@"分";
|
||||
label2.font=[UIFont systemFontOfSize:15];
|
||||
label2.textAlignment=NSTextAlignmentCenter;
|
||||
[_backgroundImage addSubview:label2];
|
||||
UILabel *label3 = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(label2.frame),_startLabel.frame.origin.y+30, _picView.frame.size.width/6, 20)];
|
||||
label3.text=@"秒";
|
||||
label3.font=[UIFont systemFontOfSize:15];
|
||||
label3.textAlignment=NSTextAlignmentCenter;
|
||||
[_backgroundImage addSubview:label3];
|
||||
UILabel *label4 = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(label3.frame),_startLabel.frame.origin.y+30, _picView.frame.size.width/6, 20)];
|
||||
label4.text=@"时";
|
||||
label4.font=[UIFont systemFontOfSize:15];
|
||||
label4.textAlignment=NSTextAlignmentCenter;
|
||||
[_backgroundImage addSubview:label4];
|
||||
|
||||
UILabel *label5 = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(label4.frame),_startLabel.frame.origin.y+30, _picView.frame.size.width/6, 20)];
|
||||
label5.text=@"分";
|
||||
label5.font=[UIFont systemFontOfSize:15];
|
||||
label5.textAlignment=NSTextAlignmentCenter;
|
||||
[_backgroundImage addSubview:label5];
|
||||
|
||||
UILabel *label6 = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(label5.frame),_startLabel.frame.origin.y+30, _picView.frame.size.width/6, 20)];
|
||||
label6.text=@"秒";
|
||||
label6.font=[UIFont systemFontOfSize:15];
|
||||
label6.textAlignment=NSTextAlignmentCenter;
|
||||
[_backgroundImage addSubview:label6];
|
||||
}
|
||||
|
||||
[_picView reloadAllComponents];
|
||||
}
|
||||
|
||||
- (void)setHaveDelected:(BOOL)haveDelected {
|
||||
|
||||
Reference in New Issue
Block a user