当我添加带有cornerRadius的superView并设置masksToBounds是时, 在屏幕外不会发生这种情况。然后我在superView上添加了一个subView,屏幕外就出现了。但是在tableViewCell中,同样的情况下,屏幕外永远不会发生。有人可以对此进行解释吗?
- (void)viewDidLoad {
[super viewDidLoad];
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(-25, 100, 50, 50)];
[self.view addSubview:view];
view.backgroundColor = [UIColor greenColor];
view.layer.cornerRadius = 25;
view.layer.masksToBounds = YES;
UIView *viewTwo = [[UIView alloc]initWithFrame:CGRectMake(25, 25, 5, 5)];
[view addSubview:viewTwo];
viewTwo.backgroundColor = [UIColor grayColor];
}