Tag: cornerradius

Swift – angular落半径和阴影的问题

我试图创build一个圆angular和阴影的button。 无论我如何切换,该button将无法正确显示。 我试过masksToBounds = false和masksToBounds = true ,但是无论是angular落半径的作品和阴影不或阴影的作品和angular落半径不剪辑button的angular落。 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 : UIColor = […]

UIlabel layer.cornerRadius无法在iOS 7.1中使用

我目前正在寻找与属性addMessageLabel.layer.cornerRadius = 5.0f;的UILabel addMessageLabel.layer.cornerRadius = 5.0f; 在安装有iOS 7.0的设备上,它具有圆angular。 在装有iOS 7.1的设备上,它没有圆angular。 这只是一个与iOS 7.1的错误?

UIView animateWithDuration不会animationcornerRadius变体

我正在尝试animationUIView实例layer的cornerRadius的变化,但cornerRadius的变化立即发生。 代码如下: UIView *view = [[UIView alloc] initWithFrame:CGRectMake(10, 10, 100, 100)]; view.layer.masksToBounds = YES; view.layer.cornerRadius = 10.0; [UIView animateWithDuration:1.0 animations:^{ [view.layer.cornerRadius = 0.0; }]; 谢谢大家谁给我任何提示。 编辑: 我设法使用Core Animation ,使用CABasicAnimationanimation这个属性。 CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"cornerRadius"]; animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; animation.fromValue = [NSNumber numberWithFloat:10.0f]; animation.toValue = [NSNumber numberWithFloat:0.0f]; animation.duration = 1.0; [viewToAnimate.layer addAnimation:animation forKey:@"cornerRadius"]; [animation.layer setCornerRadius:0.0];

如何设置cornerRadius只有左上angular和右上angular的UIView?

有没有办法设置cornerRadius只有左上angular和右上angular的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;