Reputation: 562
I'm trying to customize the width of my headerview on a UITableVIew. Unfortunately no matter what parameters I give it in the setframe method it always seems to have a width that is same as the tableview. I couldn't find an answer that talked about this, most answers seemed to talk about the section headers as opposed to the talbeviewheaders. Can anyone tell me of a way to customize the width of a tableview header?
Edit:
(void)viewDidLoad {
UIImageView *myImage =[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"takephoto.png"]];
[myImage setFrame:CGRectMake(0, 0, 50, 100)];
[[self myTable]setTableHeaderView:myImage;
}
Upvotes: 0
Views: 1025
Reputation: 38728
Add myImage
as the child of another view. The containing view will be automatically resized but you can then configure myImage
to be the size you require.
Upvotes: 2