I am creating a custom time picker, using this question as a guide and my columns don't line up.
Here is where I create the hour and minutes labels:
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];
Here is my 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;
}
How do I get the 0 to line up with the bottom numbers?