1、clipsToBounds 默认为NO。代码:
UIView *tmpView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 200)]; tmpView.clipsToBounds = YES;//分别设置 YES /NO查看效果 [self.view addSubview:tmpView]; UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"changmen.jpg"]]; [tmpView addSubview:imageView];
当为NO时:如图
设置为YES,如图
时间: 2024-11-05 06:26:09