The reuse mechanism of ios UItableView and UITableViewHeaderFooterView grouping headers, which is a simple and affically transformed CGAffineTransform
How to Set a section of the same height, including the first column (TIPS, though easy but easy to ignore)
* Step 1: Set the tail end to 0 in viewdidload, and table. sectionFooterHeight = 0; (proxy method)-(CGFloat) tableView :( UITableView *) tableView heightForFooterInSection :( NSInteger) section {
Return 0;
} You can also set the tail height, but it does not work after setting.
Step 2: Call the tableView proxy method-(CGFloat) tableView :( UITableView *) tableView heightForHeaderInSection :( NSInteger) section {
Return 30;
} Set the header height to 30;
Running result
Reuse of custom group headers (similar to cell)
If the custom group Header
To optimize the memory, you can use a cell-like reuse mechanism.
# Pragma mark-custom group Header
-(UIView *) tableView :( UITableView *) tableView viewForHeaderInSection :( NSInteger) section {
Static NSString * identy = @ "headFoot ";
UITableViewHeaderFooterView * hf = [tableView dequeueReusableHeaderFooterViewWithIdentifier: identy];
If (! Hf ){
NSLog (@ "% li", section );
Hf = [[UITableViewHeaderFooterView alloc] initWithReuseIdentifier: identy];
UIView * view = [[UIView alloc] initWithFrame: CGRectMake (0, 0, self. view. frame. size. width, 44)];
View. backgroundColor = [UIColor redColor];
[Hf addSubview: view]; (if this comment: view is not added)
}
// Hf. contentView. backgroundColor = [UIColor purpleColor]; (remove this line comment: You can set hf. ContentView background color). If this line and the previous line are not commented, red is displayed.
Return hf;
}
Affine Transformation
-(Void) clickAction {
// Affine Transformation
// [UIView animateWithDuration: 0.5 animations: ^ {
//// Run once
/// Self. rectView. transform = CGAffineTransformMakeTranslation (100,100 );
/// Continue execution based on self. rectView. transform
//// Self. rectView. transform = CGAffineTransformTranslate (self. rectView. transform, 100,100 );
//}];
//
/// Affine ratio
// [UIView animateWithDuration: 0.5 animations: ^ {
//// Run once
// Self. rectView. transform = CGAffineTransformMakeScale (5, 0.5 );
/// Continue execution based on self. rectView. transform
/// Self. rectView. transform = CGAffineTransformScale (self. rectView. transform, 2, 2 );
// Self. rectView. transform = CGAffineTransformMakeTranslation (100,100 );
//
//}];
// Affine Rotation
[UIView animateWithDuration: 0.5 animations: ^ {
// 100 degrees
CGFloat degree100 = 100/180. 0 * M_PI;
CGFloat degree45 = M_PI_4;
// Execute once
// Self. rectView. transform = CGAffineTransformMakeRotation (M_PI_4 );
// Continue execution based on self. rectView. transform
Self. rectView. transform = CGAffineTransformRotate (self. rectView. transform, degree100 );
}];
}
Ios UItableView and UITableViewHeaderFooterView group headers can be reused. They can be easily converted to CGAffineTransformios UItableView and UITableViewHeaderFooterView group headers. They can be easily converted to CGAffineTransformios UItableView and grouping headers, simple ing of CGAffineTransform