【代码笔记】iOS-给UIImageView加上圆角效果

来源:互联网 发布:阿里云 共享存储 编辑:程序博客网 时间:2024/06/07 00:12

一,效果图。

二,代码。

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.}
复制代码

 


0 0
原创粉丝点击