第一个圆圈内的第二个圆圈

时间:2016-08-04 09:23:43

标签: ios objective-c uiview cornerradius

我想把新的圆圈放在第二个更大的圆圈上。 以下是我的代码:

self.circleView = [[UIView alloc] init];
[self.circleView setBackgroundColor:[UIColor clearColor]];
[self.circleView setClipsToBounds:YES];
[self.circleView.layer setCornerRadius:self.contentView.frame.size.width/2];
[self.circleView.layer setBorderColor:[UIColor colorWithRed:0.80 green:0.26 blue:0.82 alpha:1].CGColor];
[self.circleView.layer setBorderWidth:5];
[self.contentView addSubview:self.circleView];

self.circleView2 = [[UIView alloc] initWithFrame:CGRectMake(self.contentView.frame.size.width/2,20,20,20)];
self.circleView2.layer.cornerRadius = 10;
self.circleView2.backgroundColor = [UIColor blueColor];
[self.contentView addSubview:self.circleView2];

所以,结果现在是:

enter image description here

最终结果显示在下面的照片上: enter image description here

0 个答案:

没有答案