Grouped UITableViews and Image Masking

So, with the combined UITableView, I expect that the image placed in the UITableViewCell imageView on the top line will look like this (from the iTunes application):

YES PLEASE

Instead, I get the following:

WAAAAAAH

The section does not mask the image of the cell. Why not? I tried everything I could think of. As far as I can tell, this is a standard swamp setting. UITableView is part of the UITableViewController, without a custom UITableViewCell.

Anyone else run into this? Is there an easy way to achieve this without custom UITableViewCells? I tried Matt Gallagher's code , but it did not mask the image in the top (and bottom) lines.

+3
source share
3

, , imageView.clipsToBounds?

( , ).

...

#import <QuartzCore/QuartzCore.h>


cell.imageView.layer.masksToBounds = YES;
cell.imageView.layer.cornerRadius = 9.0;

( , 9.0 , "".)

, , , . , , , ( ), , , . Fussy , , .

, , , UIImage, , cellForRowAtIndexPath UIImage, , , .

CGContextClipToMask , .

+3

, ( iOS 5):

#import <QuartzCore/QuartzCore.h>
...
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    cell.contentView.layer.masksToBounds = YES;
    cell.contentView.layer.cornerRadius = 9.0f;
}

UITableView, subviews, .

+4

Source: https://habr.com/ru/post/1786808/


All Articles