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