I’m adding a image to a image view and then adding the image view to a view. The custom view is ignoring its own frame and getting the height from the image view. How can I solve this?
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIImage* image = [UIImage imageNamed:@"UILabelMe.png"];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, image.size.width, image.size.height)];
[imageView setImage:image];
UIView* customView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 100)];
[customView addSubview:imageView];
return customView;
}
You need to also implement:
As per the docs, the header view will only work correctly when this is implemented.