简体   繁体   中英

UITableView Header View Width

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;
}

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM