gpt4 book ai didi

objective-c - 带有 UIImageView 的 UIView 更大

转载 作者:行者123 更新时间:2023-12-04 02:44:02 27 4
gpt4 key购买 nike

我有一个 UIView,里面有一个更大的 UIImageView。有没有办法隐藏超出 View 大小的内容?

CGRect baseFrame = CGRectMake(100, 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];

非常感谢!

最佳答案

UIView.clipsToBounds = YES

UIView Class Reference

关于objective-c - 带有 UIImageView 的 UIView 更大,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6143815/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com