首页 > 移动平台 > 详细

iOS常用技术-图片圆角

时间:2016-01-20 22:35:42      阅读:257      评论:0      收藏:0      [点我收藏+]

//
//  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
/********************************************************/

技术分享

iOS常用技术-图片圆角

原文:http://www.cnblogs.com/MrWuYindi/p/5146667.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!