So I have a uipickerview with rows that only contain the number 0-24 and it looks a bit silly since the numbers are left aligned leaving a huge gap on the right of the picke
Remember, the view in
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
is actually a UITableViewCell, so you can work with it like:
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{
static NSString *cellIdentifier = @"pickerViewCell";
UITableViewCell *cell = (UITableViewCell*)view;
if(cell==nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease];
/** customize the cell **/
}
/** set the label **/
cell.textLabel.text = [dataSource objectAtIndex:row];
return cell;
}