声明一个对象:
@property (strong,nonatomic)UIImageView *headeImage;
.m文件实现
- (UIImageView *)headeImage {
if (!_headeImage) {
_headeImage=[[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 45, 45)];
[_headeImage.layer setCornerRadius:(_headeImage.frame.size.height/2)];
[_headeImage.layer setMasksToBounds:YES];
[_headeImage setContentMode:UIViewContentModeScaleAspectFill];
[_headeImage setClipsToBounds:YES];
_headeImage.image=[UIImage imageNamed:@"11263709964dca169ao.jpg"];
[self addSubview:_headeImage];
_headeImage.userInteractionEnabled = YES;
}
return _headeImage;
}