1. The following is the code of the data model:
2. The above is the entire content of this article. I hope it will be helpful to everyone’s study and I hope everyone will support me more.
3. Let’s take a look at the code of the Frame model:
4. The Controller interface is to put the model into the cell.
5. In the implementation file of setting the Frame model.m
6. Cell implementation file.m:
7. Let’s take a look at the effect:
8. First of all, we need to prepare a data model. Only with the data model can we calculate the size of the text and obtain the Frame model.
9. Note: I have another property here, repairViewFrameArr, which is the Frame that loads every reply in my reply area.
10. Because my page is more complicated, there are many subcontrols, so there are many attributes.
11. Then let’s take a look at the header file of Cell.h:
12. I put all the reply frames in this array. (If your page does not have a reply area, it will be omitted here)
13. Remember, the font size set in the Frame model should be the same as that shown in the cell.
14. Main code:
15. In the .h file:
16. I made another view for each reply in the reply area, so each reply view must correspond to a reply Frame.