[UIPickerView Case 02 - Order display data defaults to Objective-C language]

1. This display datanotify

1. In it, there are data source protocol and proxy protocol. In the past, how to use it in TableView,

How did we do it before,

1) Step 1: Did you set the data,

notify

Set the data source object, proxy object, and then,

Then, our Main.storyboard, right click,

notify

Drag this data source object to the controller

notify

The proxy object is also dragged into the controller

notify

Then, in the controller, do you abide by the corresponding protocol?

notify
notify
notify
notify

Then, let’s go in and take a look, it’s the data source proxy protocol,

notify

Hold down the command key, jump in,

notify

There are several data source methods,

only two,

1) numberOfComponentsInPickerView: returns how many groups you have

For this PickerView, its column by column is a group,

A column is a group,

2) numberOfRowsInComponent: how many rows per group,

Then, inside the PickerViewDelegate,

notify

Are these proxy methods,

notify

Then, do we want to display some text content now,

Let's see, which one do you need to use?

1) Is the return type NSString, and then,

titleForRow: What content is displayed in each row,

What headings are displayed on each line,

Now you know what to do, follow its protocol,

notify

Delete this didReceiveMemoryWarning method

notify

Is there a way to achieve it, on the line,

what, is the first one

1)numberOfComponentsInPickerView:

notify

returns how many groups there are, right,

2) Then, there is another one called, first enter a minus sign pickerView,

notify

numberOfRowsInComponent:

notify

Return how many rows are in each group:

notify

But, have you noticed that in our PickerView, its display content is not in the proxy method,

notify

Inside the TableView, where,

Return the content displayed by each row of Cell, whether it is in the data source method,

Here's a little difference between them,

Next, what to do,

notify

1) numberOfComponents: whether to return how many groups,

How do you determine this group?

Have a look inside your array,

notify

total?

Guess you like

Origin blog.csdn.net/madoca/article/details/132601451