给UIView增加边框

这里用到了UIView 的layer属性。因为这里UIView上的做法,所以对于所有从UIView继承下来的控件,都可以采用这个方法来添加边框。 如果要使用layer,需要在头部添加 以下引用 #import <QuartzCore/QuartzCore.h>   下面是为一个UIView添加了圆角矩形蓝色边框的代码。 _logTextView.layer.backgroundColor = [[UIColor clearColor] CGColor]; _logTextView.layer.borderColor = [[UIColor colorWithRed:0.0/255.0 green:167.0/255.0 blue:253.0/255.0 alpha:1.0]CGColor]; _logTextView.layer.borderWidth = 3.0; _logTextView.layer.cornerRadius = 8.0f; [_logTextView.layer setMasksToBounds:YES];

posted on 2012-12-10 11:55  流れ星ーー  阅读(161)  评论(0编辑  收藏  举报

导航