2015-07-19 113 views

回答

0

如何添加新图层?

yourView.clipsToBounds = YES; 

CALayer *topBorder = [CALayer layer]; 
topBorder.borderColor = [UIColor redColor].CGColor; 
topBorder.borderWidth = 1; 
topBorder.frame = CGRectMake(0, 0, CGRectGetWidth(self.frame), 2);  
[yourView.layer addSublayer:topBorder]; 

取代yourView与任何观点是包含在您要添加的边框到您的视图控制器。

此外,this related answer可能会帮助你一点。