ピッカー内のテキストの色をさまざまな色で変更する方法。例えば:
user865155
質問する
1824 次
2 に答える
3
を使用pickerView:viewForRow
して、必要な色の UILabel を返します
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{
UILabel *label = [[UILabel alloc] init];
label.text = @"Row";
label.textColor = [UIColor greenColor];
return label;
}
于 2012-06-29T11:03:53.013 に答える
0
これを試して:-
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view {
UILabel *demoLbl = (id)view;
if (!demoLbl) {
demoLbl= [[[UILabel alloc] initWithFrame:CGRectMake(0.0f, 0.0f, [pickerView rowSizeForComponent:component].width, [pickerView rowSizeForComponent:component].height)] autorelease];
}
demoLbl.text = @"Demo";
demoLbl.textColor = [UIColor redColor];
demoLbl.font = [UIFont systemFontOfSize:14];
return demoLbl;
}
于 2012-06-29T11:08:51.517 に答える