0
我正在创建一个自定义时间选择器,使用this问题作为指南,我的列不排队。UIPickerView居中的列
这里是我创建的小时和分钟标签:
UILabel *hourLabel = [[UILabel alloc] initWithFrame:CGRectMake(datePickerCell.pickerView.frame.size.width/2 - 25, datePickerCell.pickerView.frame.size.height/2 - 15, 50, 30)];
hourLabel.text = @"hour";
[datePickerCell.pickerView addSubview:hourLabel];
UILabel *minsLabel = [[UILabel alloc] initWithFrame:CGRectMake(datePickerCell.pickerView.frame.size.width - 25, datePickerCell.pickerView.frame.size.height/2 - 15, 50, 30)];
minsLabel.text = @"min";
[datePickerCell.pickerView addSubview:minsLabel];
这里是我的viewForRow:
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{
UILabel *columnView = [[UILabel alloc] initWithFrame:CGRectMake(pickerView.frame.size.width/4 - 15, 0, 35, 30)];
columnView.text = [NSString stringWithFormat:@"%lu", row];
columnView.textAlignment = NSTextAlignmentRight;
return columnView;
}
如何获得0与排队底部数字?
固定它的时候了。谢谢! – Siriss 2015-03-13 18:26:55