如何更改UIPickerView字体大小

时间:2015-09-13 01:34:48

标签: swift uipickerview

如何更改字体大小。我的代码不起作用。我在iOS 9.1上使用xcode7.1和swift 2。

library(ggplot2)
ggplot(CFL.old, aes(x=factor(Year), y=BA_Li)) + 
  stat_summary(fun.data=function(y)c(ymax=mean(y)+1.96*se(y),ymin=0), geom="errorbar", width=0.1)+
  stat_summary(fun.y=mean, geom="bar", fill="grey70", color="black")+
  geom_text(data=HSD.li$groups, aes(x=sub("\\s+","",trt), y=0, label=M), vjust=-1)+
  coord_cartesian(ylim=c(-2,100), )+
  labs(x="Year of SB Outbreak", y="Li (m2/ha)") +
  theme_bw()+theme(panel.grid=element_blank())

案例1工作正常,而案例0并未改变它的字体大小。

1 个答案:

答案 0 :(得分:1)

Swift 4

   func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView {

      var title = UILabel()
         if let title = view {
                title = title as! UILabel
          }
        title.font = UIFont.systemFont(ofSize: 21, weight: UIFont.Weight.bold)
        title.textColor = UIColor.blue
        title.text =  PickerArray[row]
        title.textAlignment = .center

    return title

    }