问题
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