Hey people, I put UIImage in the section header of my UITableVIew. So I used the code that I found on the Internet:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
self.imageViewForImage.image = [helperClass resizeImage:[self.offerItem objectForKey: @"picture"] forSize:CGSizeMake(280.0, 280.0) ];
[self.imageViewForImage.layer setBorderColor: [[UIColor blackColor] CGColor]];
[self.imageViewForImage.layer setBorderWidth: 1.2];
self.imageViewForImage.contentMode = UIViewContentModeBottom;
return self.imageViewForImage;}
-(CGFloat)tableView:(UITableView*)tableView heightForHeaderInSection:(NSInteger)section
{
if(section == 0)
return 320;
return 1.0;
}
At first, the image was fully scaled over the entire width of the iphone with a size of 320 pixels. But then I found out that all of my UITableView contentMode property was set to "UIViewContentModeScaleToFill". So I added a line of code that tells my UIImageView not to scale. In my case, I set it to "UIViewContentModeBottom".
Problem: it all works, the image is finally shown in an aspected size of 280x280, BUT the border that I made around the picture is still stretched / resized to the full width of the iphone ...?!
, , UIImage.
.
edit: - , ?