UIPickerView 修改里面的字体大小

时间:2024-02-25 10:08:48
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{
UILabel *myView = nil;      
if (component == 0) {
myView = [[[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.0, 100, 30)] autorelease];
myView.textAlignment = UITextAlignmentCenter;
myView.text = [pickerNameArray objectAtIndex:row];
myView.font = [UIFont systemFontOfSize:14];         //用label来设置字体大小
myView.backgroundColor = [UIColor clearColor];
}else {
myView = [[[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.0, 180, 30)] autorelease];
myView.text = [pickerPlaceArray objectAtIndex:row];
myView.textAlignment = UITextAlignmentCenter;
myView.font = [UIFont systemFontOfSize:14];
myView.backgroundColor = [UIColor clearColor];
}
return myView;
}