jjzjj

cornerradius

全部标签

iphone - 如果用自定义子类替换默认 View ,则 cornerRadius 不起作用

以下设置:我有一个popupViewController,它有一个自定义的UIView子类作为它的View,在loadView中完成-(void)loadView{CGRectstartingPopupSize=CGRectMake(0.0f,0.0f,300.0f,160.0f);_popupView=[[MoviePopupViewalloc]initWithFrame:startingPopupSize];self.view=_popupView;}在这个UIView子类中,我在它的初始化方法中有以下代码-(id)initWithFrame:(CGRect)frame{self=

ios - 自定义 UITableViewCell 中 UIView 的仅两个角 - iOS

我在自定义UITableViewCell中有一个UIView,我想将View的左下角和右下角圆化。我正在执行以下操作,但它不起作用:-(void)awakeFromNib{//InitializationcodeCAShapeLayer*maskLayer=[CAShapeLayerlayer];maskLayer.path=[UIBezierPathbezierPathWithRoundedRect:_viewForTags.boundsbyRoundingCorners:UIRectCornerBottomLeft|UIRectCornerBottomRightcornerRadi

iphone - UITableView cornerRadius 在 iOS 上存在边界性能问题

我有一些关于UITableView滚动性能的有趣通知,其中启用了cornerRadius、borderWidth和borderColor。self.tableView.layer.cornerRadius=10.f;self.tableView.layer.borderWidth=1.0f;self.tableView.layer.borderColor=[UIColorwhiteColor].CGColor;如果我删除borderWidth和borderColor滚动得到60FPS没问题。只要我将这两个属性添加到图层FPS下降。有没有人建议或解释为什么会发生这种奇怪的行为?非常感谢!

ios - 向每个单元格添加带有 cornerRadius 的 UILabel 时,UITableView 开始爬行

我正在为表格View中的每个单元格添加一个UILabel。这最初没有问题。当我使用layer.cornerRadius滚动UILabel的角时,表格View逐渐停止。UILabel*label1=[[UILabelalloc]initWithFrame:CGRectMake(cell.bounds.origin.x+10,5,30,30)];label1.backgroundColor=([[managedObjectvalueForKey:@"color"]hasPrefix:@"FFFFFF"])?[UIColorblackColor]:color;label1.layer.cor

ios - 使用 cornerRadius 获取 UIView 中矩形的大小

我有一个带圆角的UIView。如何获取内部矩形的大小? 最佳答案 如果你希望能够得到类似绿色矩形的东西here.您可以使用此方法,将红色矩形作为参数传递:funcinnerRectangle(view:UIView)->CGRect{letradius=view.layer.cornerRadius*(1-M_SQRT1_2)letorigin=CGPoint(x:view.frame.origin.x+radius,y:view.frame.origin.y+radius)letsize=CGSize(width:view.fra

ios - UIBezierPath 和 CAShapeLayer 不创建角线

这是我的代码publicfuncsetMaskTo(setMask:UIView,corner:UIRectCorner)->Void{letround=UIBezierPath(roundedRect:setMask.bounds,byRoundingCorners:corner,cornerRadii:CGSize(width:10,height:10))letshape=CAShapeLayer()shape.frame=round.boundsshape.path=round.cgPathsetMask.layer.mask=shape}setMaskTo(setMask:se

ios - 在 UIView 类中添加 UIView 舍入逻辑

我有一个自定义的UIView,我将它添加到我的ViewController中,如下所示:letmyCustomView=Bundle.main.loadNibNamed("MyCustomView",owner:nil,options:nil)as!MyCustomViewmyCustomView.layer.cornerRadius=10myCustomView.layer.masksToBounds=true我绕过View的角落。但我想知道,有没有办法在MyCustomView类中移动这种圆角逻辑? 最佳答案 当你使用IB时,你

ios - 圆角半径仅适用于 View 的左上角和左下角

我只需要对View的左上角和左下角进行圆角处理,所以我尝试了这个:functableView(_tableView:UITableView,cellForRowAtindexPath:IndexPath)->UITableViewCell{letcell=tableView.dequeueReusableCell(withIdentifier:"teamCell",for:indexPath)as!TeamCellletview=cell.backgroundCellViewletrectShape=CAShapeLayer()rectShape.bounds=(view?.frame

swift - UIView.animateWithDuration 没有动画

我的ViewControllerviewDidLoad函数中的UIView.animateWithDuration调用没有动画。立即调用完成block。println输出显示“完成为真”。viewDidLoad函数是否放错了我的启动动画?非常感谢任何提示。classViewController:UIViewController{@IBOutletvarbeatIndicator:UIView?overridefuncviewDidLoad(){super.viewDidLoad()ifletled=beatIndicator?{led.alpha=1.0led.frame=CGRect

ios - 如何使用 cornerradius 去除 CALayer 周围的丑陋边框?

我正在使用CoreGraphics绘制一个简单的折线图。我创建了一个继承自UIControl的自定义类LineChart。在此图表的顶部,我想添加一个小的实心圆圈,触摸时会显示动画(更改边框颜色)。这是我的圆圈在每个(x,y)点的代码。varlayer=CALayer()layer.borderColor=UIColor.whiteColor().CGColorlayer.backgroundColor=UIColor.blackColor().CGColorlayer.cornerRadius=8layer.borderWidth=4layer.frame=CGRect(x:xVal