ios中修改自定义PickerView的字体颜色

来源:互联网 发布:ubuntu 如何安装软件 编辑:程序博客网 时间:2024/05/12 16:31
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view{      UILabel* pickerLabel = (UILabel*)view;      if (!pickerLabel){          pickerLabel = [[UILabel alloc] init];          // Setup label properties - frame, font, colors etc          //adjustsFontSizeToFitWidth property to YES          [pickerLabel setBackgroundColor:[UIColor clearColor]];          [pickerLabel setFont:[UIFont boldSystemFontOfSize:15]];      }      // Fill the label text here      pickerLabel.text=[self pickerView:pickerView titleForRow:row forComponent:component];      pickerLabel.textAlignment = NSTextAlignmentCenter;      return pickerLabel;  }

原创粉丝点击