我创建了一个十进制数UIPickerView
。我希望第二个组件只是一个常量点字符串 (.) 成为分隔符,我的意思是:
1)它不动
2)它的宽度小于其他组件
3)与其他组件相比,它的颜色不同
这是代码:
#pragma mark - UIPickerView : Datasource Protocol
-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
return 3;
}
-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { if(component == 2)
return 10;
if(component == 1)
return 1;
else
return 1000;
}
-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
if(component == 1)
return @".";
else
return [NSString stringWithFormat:@"%ld", (long)row];
}
我怎样才能做到这一点?