gpt4 book ai didi

ios - UIImageview 方面填充和 clipsToBounds ,如何使 subview 不被剪裁?

转载 作者:行者123 更新时间:2023-12-01 22:33:19 24 4
gpt4 key购买 nike

  UIImageView*  parentView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
parentView.contentMode = UIViewContentModeScaleAspectFill;
parentView.clipsToBounds = YES;

UIImageView* subview = [[UIImageView alloc]initWithFrame:CGRectMake(-4, 0, 37, 16)];
[parentView addSubview: subview];

当 parentView 必须具有 clipsToBounds 为 Yes 时, subview 如何不被 parentView 剪辑?

最佳答案

答案是否定的——那是不可能的。

来自 Apple Documentation ,

clipsToBounds property

A Boolean value that determines whether subviews are confined to the bounds of the view.

Discussion Setting this value to YES causes subviews to be clipped to the bounds of the receiver. If set to NO, subviews whose frames extend beyond the visible bounds of the receiver are not clipped. The default value is NO.

关于ios - UIImageview 方面填充和 clipsToBounds ,如何使 subview 不被剪裁?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33143223/

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