There are two ways to customize a cell:
First: By creating a Xib file.
① first create the Xib file
② creates a xib file corresponding to the model A, with the same name as the Xib file, inherits the UITableViewCell class, and implements the Cellwithtableview construction method.
③ Change the default class for xib files in Interface Builder, the model class created for the second step.
④ Create data Model B, and a contains data Model B
⑤a assigns a value to a control by lazy loading the B method (that is, by overriding the setter method of the B object).
The second type: code-Custom Cell
① Create a new class that inherits UITableViewCell, which has a frame model
② overriding Initwithstyle:reuseidentifier: Method (
Add all the child controls that need to be displayed (you don't need to set the child control's data and frame, and the child controls are added to the Contentview)
There are also add property settings
)
③ Building a data model
④ Building a frame model (owning a data model)
⑤ overrides the setter method of the data model object, then sets the control size, and the cell height.
The ⑥ controller has an array of frame objects. When the cell is in trouble, assign it directly to the Cell.frame object.
iOS Developer Tabelview Custom cell