views:

1153

answers:

2

Hello,all iphone developers

I am currently developing an iphone application in which I am showing a uitableview in grouped style in one of the segments of the segmented control.

My problem is that I don't know how to show a small image dynamically in the table header view.

Another issue is that i don't know how to show labels and button or any other control in one cell of a particular section and also make them multi line.

If any one have code or example please help me doing this.

+1  A: 

This one will replace your header with a view, you can add anything there:

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
}
Cristi Băluță
A: 

it can be done by this code:

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

    UIImageView *myImageView = [[UIImageView alloc]initWithFrame:CGRectMake(15, 10, 35, 35)];
    myImageView.image = [UIImage imageNamed:@"r1.jpg"];
    myImageView.contentMode = UIViewContentModeScaleToFill;
    [trialHeaderView addSubview:myImageView];

myDetailView.tableHeaderView = trialHeaderView;

ok..

hib