UIView怎么画圆?

来源:3-17 View透明度隐藏属性介绍

幕布斯2332854

2018-06-07 20:44:57

代码怎么写呢?

写回答

2回答

imoocLovers

2018-06-08

例如:下面代码UIView画圆

    
   UIView *myView = [[UIView alloc] init];
   myView.frame = CGRectMake(0, 0, 40, 40);
   myView.center = self.view.center;
   myView.layer.cornerRadius = 20;
   myView.layer.masksToBounds = YES;
   myView.layer.borderColor = [[UIColor greenColor]CGColor];
   myView.layer.borderWidth = 2; 
   [self.view addSubview:myView];


0

幕布斯2332854

提问者

2018-06-08

非常感谢啦

0

0 学习 · 1878 问题

查看课程