Add font family and font size in UIPickerView

只愿长相守 提交于 2020-01-06 12:46:08

问题


I'm a newbie to iOS programming, I have a project and my requirements are

1: I have to add font family

2: In the same way, I have to add font size

These are to be added with a done button on top and a bifurcation in between them.

Guys I have searched and cant get it, kindly help me out. Thanks in advance.


回答1:


  • Your picker view should have two components.
  • The number of rows in the first component should be the count of the items in your font family list.
  • The number of rows in the second component should be the count of the number of size options you wish to offer.

These numbers are controlled by the picker view datasource. There are only two methods in this protocol.

  • The title for each individual row should be either the name of the font family at the relevant index in your list, or the font size option.

This is covered by the picker view delegate method pickerView:titleForRow:forComponent:

Your datasource and delegate are typically the same object, usually the view controller that is presenting the picker.



来源:https://stackoverflow.com/questions/8148764/add-font-family-and-font-size-in-uipickerview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!