开发者

UIView with a UIImageView inside larger

开发者 https://www.devze.com 2023-03-08 11:34 出处:网络
I have a UIView with a UIImageView inside larger. Is there a way to hide what lies beyond the size of the view?

I have a UIView with a UIImageView inside larger. Is there a way to hide what lies beyond the size of the view?

CGRect baseFrame = CGRectMake(1开发者_如何学Go00, 100, 300, 80);
UIView *baseView = [[UIView alloc] initWithFrame:baseFrame];
[self.view addSubview:baseView];
[baseView release];


UIImageView *baseBg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 300, 335)];
[baseBg setImage: [UIImage imageNamed:[NSString stringWithFormat:@"baseView.png"]]];
[baseView addSubview: baseBg];
[baseBg release];

thanks a lot!


UIView.clipsToBounds = YES

UIView Class Reference

0

精彩评论

暂无评论...
验证码 换一张
取 消