代码笔记给UIImageView加上圆角效果
Posted 菜鸟and小白
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了代码笔记给UIImageView加上圆角效果相关的知识,希望对你有一定的参考价值。
一,效果图。
二,代码。
RootViewController.m
#import "RootViewController.h"
@interface RootViewController ()
@end
@implementation RootViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
//圆角效果
[self addView];
}
#pragma -mark -functions
//圆角效果
-(void)addView
{
UIImageView *imageView=[[UIImageView alloc]initWithFrame:CGRectMake(50, 100, 200, 200)];
imageView.backgroundColor=[UIColor greenColor];
imageView.layer.cornerRadius = 10;
imageView.clipsToBounds = YES;
[self.view addSubview:imageView];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
以上是关于代码笔记给UIImageView加上圆角效果的主要内容,如果未能解决你的问题,请参考以下文章