//
// ViewController.m
// 图片圆角
//
// Created by 大欢 on 16/1/20.
// Copyright © 2016年 bjsxt. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
//CALayer:决定UIView样式的类
UIImage * image = [UIImage imageNamed:@"touxiang.jpg"];
UIImageView * imageView = [[UIImageView alloc] initWithImage:image];
imageView.frame = CGRectMake(100, 100, 100, 100);
//给图片加圆角
// imageView.layer.cornerRadius = 50;
// imageView.layer.masksToBounds = YES;
// imageView.clipsToBounds = YES;
// 设置边线宽度
imageView.layer.borderWidth = 2;
// 设置边线颜色
imageView.layer.borderColor = [UIColor blackColor].CGColor;
//阴影颜色
imageView.layer.shadowColor = [UIColor redColor].CGColor;
//阴影大小
imageView.layer.shadowOffset = CGSizeMake(10,10);
//不透明度
imageView.layer.shadowOpacity = 0.3;
[self.view addSubview:imageView];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
/********************************************************/
原文:http://www.cnblogs.com/MrWuYindi/p/5146667.html