标签:
//根据button高度来设置字体大小
CGFloat dayLabelWidth = (viewWidth-10)/7-1;
cancelButton = [[UIButton alloc] initWithFrame:CGRectMake(viewWidth/2, viewHeight-dayLabelWidth*1.2, viewWidth/2, dayLabelWidth*1.2)];
cancelButton.titleLabel.font = [UIFont boldSystemFontOfSize:dayLabelWidth*0.5];
[cancelButton setTitle:@"取消" forState:UIControlStateNormal];
cancelButton.backgroundColor = [UIColor grayColor];
[cancelButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[cancelButton addTarget:self action:@selector(cancelSelectCurrentDate) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:cancelButton fixedOn:viewName fixed:true];
标签:
原文地址:http://www.cnblogs.com/liuting-1204/p/5583200.html