我也这样做了(尽管 iOS4 中联系人应用程序的更改尚无争议!)我的解决方案使用两个不同的标题视图并根据以下内容在它们之间切换isEditing
:
- (UIView *)infoHeaderAnimated:(BOOL)animated {
UIView *header = [[[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 90.0)] autorelease];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(98.0, 41.0, 221.0, 21.0)];
label.font = [UIFont boldSystemFontOfSize:17.0];
label.backgroundColor = [UIColor clearColor];
label.text = baseEntity.labelText;
[header addSubview:label];
[label release];
return header;
}
- (UIView *)editingHeaderAnimated:(BOOL)animated {
UIView *header = [[[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 90.0)] autorelease];
UITableView *tv = [[UITableView alloc] initWithFrame:CGRectMake(78.0, 10.0, 240.0, 90.0) style:UITableViewStyleGrouped];
tv.backgroundColor = [UIColor clearColor];
tv.dataSource = self;
tv.delegate = self;
tv.rowHeight = 62.0; //@@@ height of cell and frame depend on elements
tv.tag = kEditingHeaderTag;
editingHeaderTableView = [tv retain];
[header addSubview:tv];
[tv release];
return header;
}