---
title: "iphone app 为图片添加边框"
author: "bengan"
date: "2012-03-17T01:30:56Z"
tags: []
categories: ["移动开发"]
slug: "iphone-app"
draft: false
lastmod: "2012-03-17T01:30:56Z"
id: 1455774
url: "https://bengan.iteye.com/blog/1455774"
---

头文件中#import <QuartzCore/QuartzCore.h>
当然Framework中需要有QuartzCore.framework

UIImageView* leftView = [[UIImageView alloc] init];
    leftView.contentMode = UIViewContentModeScaleAspectFit;
    leftView.tag = AlbumTableViewCell_LeftImageView;


/*加边框＊/
    leftView.layer.masksToBounds=YES; 
    leftView.layer.cornerRadius=2.0; //圆角弧度
    leftView.layer.borderWidth=1.0; //边框宽
    leftView.layer.borderColor=[[UIColor grayColor] CGColor];