? Steps to customize the cell (the height of each cell) is not the same as the contents of each cell?
New? An inheritance? Subclass from UITableViewCell
2. In the Initwithstyle: Method? Initialization of the control
1> all the child controls that are likely to be displayed are added to the Contentview
2> by the way? Some properties (? One-time settings: font,? text color, background
3.2 Models available
1>? One is the data model (?????
2>? One is the frame model (data model + All-child control's Frame + cell's height)
4. Cell should be provided? A Frame model property
1> passing the frame model to the cell
2> cell sets the frame to the child control according to the frame model, sets the data to the child control according to the data model.
3> cell determines what to show and hide based on the data model. Child controls
5. How does the agent in TableView return the cell's? height
How to calculate the size of a text label
-(Cgsize) Sizewithtext: (NSString *) text font: (Uifont *) font MAXW: (cgfloat) Maxw
{
Nsmutabledictionary *attrs = [Nsmutabledictionary dictionary];
Attrs[nsfontattributename] = font;
Cgsize maxSize = Cgsizemake (Maxw, maxfloat);
return [text boundingrectwithsize:maxsize options:nsstringdrawinguseslinefragmentorigin attributes:attrs context: Nil].size;
}
-(Cgsize) Sizewithtext: (NSString *) text font: (Uifont *) font
{
return [self Sizewithtext:text font:font maxw:maxfloat];
}
IOS? Steps to customize a cell