Questions tagged «cornerradius»

25
如何只为UIView的左上角和右上角设置cornerRadius?
有没有一种方法可以cornerRadius仅设置的左上角和右上角UIView? 我尝试了以下操作,但最终看不到该视图。 UIView *view = [[UIView alloc] initWithFrame:frame]; CALayer *layer = [CALayer layer]; UIBezierPath *shadowPath = [UIBezierPath bezierPathWithRoundedRect:frame byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight) cornerRadii:CGSizeMake(3.0, 3.0)]; layer.shadowPath = shadowPath.CGPath; view.layer.mask = layer;


14
Swift-拐角半径和阴影问题
我正在尝试创建一个带有圆角和阴影的按钮。无论我如何切换,该按钮都将无法正确显示。我尝试了masksToBounds = false和masksToBounds = true,但是要么拐角半径有效,阴影不起作用,要么阴影起作用,并且拐角半径不限制按钮的拐角。 import UIKit import QuartzCore @IBDesignable class Button : UIButton { @IBInspectable var masksToBounds: Bool = false {didSet{updateLayerProperties()}} @IBInspectable var cornerRadius : CGFloat = 0 {didSet{updateLayerProperties()}} @IBInspectable var borderWidth : CGFloat = 0 {didSet{updateLayerProperties()}} @IBInspectable var borderColor : UIColor = UIColor.clearColor() {didSet{updateLayerProperties()}} @IBInspectable var shadowColor : …

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.