taiyang2014

添加一条边框

#import <QuartzCore/QuartzCore.h>
- (void)viewDidLoad {
   CALayer *TopBorder = [CALayer layer];
   TopBorder.frame = CGRectMake(0.0f, 0.0f, myview.frame.size.width, 3.0f);    TopBorder.backgroundColor = [UIColor redColor].CGColor;
   [myview.layer addSublayer:TopBorder];  
[super viewDidLoad];
}
 
    //顶部line
        CALayer *topAdnBottom = [CALayer layer];
        topAdnBottom.frame = CGRectMake(0.0f, 0.0f, SCREEN_WIDTH, 1.0f);
        topAdnBottom.backgroundColor = LINE_CORLOR.CGColor;
        [startPlayView.layer addSublayer:topAdnBottom];
        //尾部line
        CALayer *bottomBorder = [CALayer layer];
        bottomBorder.frame = CGRectMake(0.0f, startPlayView.frame.size.height - 1, SCREEN_WIDTH, 1.0f);
        bottomBorder.backgroundColor = LINE_CORLOR.CGColor;
        [startPlayView.layer addSublayer:bottomBorder];

posted on 2015-12-04 17:04  taiyang2014  阅读(151)  评论(0编辑  收藏  举报

导航