2009-05-29 7 views
0

UITableViewのtableViewHeaderプロパティはUIViewなので、複数のサブビューを追加できます。しかし、セグメント化されたコントロールのコードを追加すると、UILabelは数行前に描画されません。矩形は、互いに重なってはいけません。tableViewHeader複数のサブビューを拒否する

私は間違っていますか?

- (void)viewDidLoad { 
[super viewDidLoad]; 

CGRect newFrame = CGRectMake(0.0, 0.0, self.tableView.bounds.size.width, 50.0); 
UIView *trialHeaderView = [[UIView alloc] initWithFrame:newFrame]; 
trialHeaderView.backgroundColor = [UIColor clearColor]; 

UILabel *label = [[[UILabel alloc] initWithFrame:CGRectMake(15.0, 10.0, 75.0, 25.0)] autorelease]; 
label.font = [UIFont boldSystemFontOfSize:12.0]; 
label.text = @"TaDa!"; 
label.backgroundColor = [UIColor clearColor]; 
label.textColor = [UIColor blackColor]; 
[trialHeaderView addSubview:label]; 
[label release]; 

CGRect frame = CGRectMake(80, 10, 100, 35); 
UISegmentedControl *seg = [[UISegmentedControl alloc] initWithFrame:frame]; 
[seg insertSegmentWithTitle:@"Start" atIndex:0 animated:NO]; 
[seg insertSegmentWithTitle:@"End" atIndex:1 animated:NO]; 
[trialHeaderView addSubview:seg]; 

[seg release]; 

self.tableView.tableHeaderView = trialHeaderView; 
[trialHeaderView release]; 

}

答えて

0

は...私は自動解放し、同じオブジェクトをリリースしていた。この先に更新している必要があります。愚かな私...

関連する問題