objName.GetType().GetProperty("nameOfProperty").SetValue(objName, objValue, null)
Можете ли вы опубликовать код для своих функций heightForHeaderInSection и viewForHeaderInSection ? Теория, лежащая в основе того, что вы делаете, звучит правильно, но, не видя кода, было бы почти невозможно выяснить проблему ...
Похоже, вы помещаете метку в представление в IB и пытаетесь использовать это как ваш заголовок - это неправильный способ делать что-то. Если вы не используете viewForHeaderInSection , попробуйте .. вот так:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UILabel *lbl;
lbl.text = @"Header for The Only Section";
//define other properties for the label - font, shadow, highlight, etc...
return lbl;
}
Не уверен, что вы делаете неправильно, но вот пример кода, который может помочь (из сообщения в моем блоге):
#define SectionHeaderHeight 40
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
if ([self tableView:tableView titleForHeaderInSection:section] != nil) {
return SectionHeaderHeight;
}
else {
// If no section header title, no section header needed
return 0;
}
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
NSString *sectionTitle = [self tableView:tableView titleForHeaderInSection:section];
if (sectionTitle == nil) {
return nil;
}
// Create label with section title
UILabel *label = [[[UILabel alloc] init] autorelease];
label.frame = CGRectMake(20, 6, 300, 30);
label.backgroundColor = [UIColor clearColor];
label.textColor = [UIColor colorWithHue:(136.0/360.0) // Slightly bluish green
saturation:1.0
brightness:0.60
alpha:1.0];
label.shadowColor = [UIColor whiteColor];
label.shadowOffset = CGSizeMake(0.0, 1.0);
label.font = [UIFont boldSystemFontOfSize:16];
label.text = sectionTitle;
// Create header view and add label as a subview
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, SectionHeaderHeight)];
[view autorelease];
[view addSubview:label];
return view;
}
У меня была такая же проблема, и я не совсем понял, почему черная полоса ..
НО вместо того, чтобы предоставлять представления верхнего и нижнего колонтитула в методах делегата,
если я установил значения для tableView.tableHeaderView
и tableView.tableFooterView
, все в порядке!