1. Okay, let’s continue to implement this flag selection interface:
1. Isn’t its interface very simple? It’s just a UIPickerView and that’s it.
Then, what about each line of content displayed?
1) A text Label
2) a picture
Then everyone should be aware that what it returns should be a View, right?
In the proxy method, there is one that returns View, viewForRow:
viewForRowInComponent:
2. Then, we created a new project,
Then, I opened this project,
1) Build the interface: a PickerView and you’re done
2) Load data: load this 03flags.plist,
3) There is another one: our picture resources are also put in it.
So many flag pictures,
4) Then, take a look at this plist again
The flag plist is also an array containing several dictionaries, right?
You can also convert a dictionary to a model,
5) Return to the Controller,
Lazy loading
Locked up and no longer seen,
Then what,
6) Next, set its data source, proxy object,
Comply with the corresponding agreement,
Implement the corresponding method:
7) What is the number of groups? It is directly 1 group.
8) What about its line number: there are as many lines as there are country models.
9) Finally, we say: we need to return a UIView,
pickerView: Does it have a viewForRow: method?
Some people say that there are too many methods and I can’t remember them. What should I do if I can’t remember them? There’s no need to remember them. We only need to remember the header file of its UIPickerView. Let’s go and see
Click this: UIPickerView
Or click on it: DataSource, Delegate
It will be all right
There's no need to memorize it by rote.
We just need to understand this idea,
This idea is enough:
2. Finally, we say, return, what view is returned for each row,
Is it set based on tableView?
Do you have an impression? When we were writing tableView earlier,
What kind of cells are returned in each row?
how is that done,
1) Step one: Create Cell
2) Step 2: Assign value to Cell, set data,
3) Part 3: Return to Cell
Then our View is the same:
1) Step one: Create View
2) Step 2: Set data for View
3) Step 3: Return to View
Someone said: Can we create a xib
This is a xib with a Label on the left:
There is an ImageView on the right: it displays a picture, right?
Then, can we set data for it and finally return to View:
The most important thing is this part, everything else is the same:
3. Okay, everyone, what should we do:
1) The first step: What is it? Create a View. If you create a View, how do you create it?
What is our View? What do we want to do for it? Is it a xib?
What should I do?
Should I create a xib first?
Then, command + N,
User Interface:View
Bring a View directly in:
Then, Name:
Name:HMFlagView.xib
Now, our xib has:
Put it up
In this case, I would still add a Group:
1)Group Name:View,
2)Group Name:Controller,
3)Group Name:Other,
4)Group Name:Model,
These two are our models: HMFlag.h, HMFlag.m
AppDelegate.h, AppDelegate.m, are these two placed in Other?
In the controller, press Shift and change these three:
Put it in the controller
Do some teachers put the Storyboard in View?
HMFlagView.xib: Put this in View
Oh:
As for the placement of this file, you can place it according to your personal habits, but the others are basically the same structure.
Then put the following three into:
Put it in SupportingFiles
4. Okay, let’s continue, now we have this xib
Then, should we change it:
Let’s first add constraints to it: Change this Size: to freedom
1) Size: Change it to freedom. Can its size be modified?