UIImageView . UIImageView contentMode - , , , .. clipToBounds YES "" .
CALayer , UIImageView. ...
imageView.layer.cornerRadius = 3.0;
imageView.layer.masksToBounds = YES;
imageView.layer.borderColor = [UIColor blackColor].CGColor;
imageView.layer.borderWidth = 1.0;
:
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier];
if ( self ) {
...
self.imageView.layer.cornerRadius = 3.0;
self.imageView.layer.masksToBounds = YES;
self.imageView.layer.borderColor = [UIColor blackColor].CGColor;
self.imageView.layer.borderWidth = 1.0;
...
}
return self;
}
. UIImage: – stretchableImageWithLeftCapWidth:topCapHeight:
UITableViewCell, . .. UITextView (textViewDidChange:) ..
Google SO.
UITableViewDelegate ...
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
... . , ...
:
UIImageView *__backgroundImageView;
Initializer:
__backgroundImageView = [[UIImageView alloc] initWithImage:...stretchableImage...];
[self.contentView addSubview:__backgroundImageView]
[self.contentView sendSubviewToBack:__backgroundImageView]
:
- (void)layoutSubviews {
[super layoutSubviews];
CGRect rect = self.contentView.bounds;
rect.origin.y += 5;
rect.size.height -= 2 * 5;
__backgroundImageView.frame = rect;
...
}
:
- (void)dealloc {
[super dealloc];
[__backgroundImageView release]; __backgroundImage = nil;
...
}