gpt4 book ai didi

ios - 直接从iOS中的Self.view计算UIButton的起源

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

我的对象的层次结构如下

假设UIButton的对象名称是“myButton”。
现在,有没有办法通过直接从self.view计算'myButton'的原点(X坐标,Y坐标),而不使用任何中间对象的框架

任何意见或建议,将不胜感激。

先感谢您。

最佳答案

对于UIView

- (CGPoint)convertPoint:(CGPoint)point toView:(UIView *)view;
- (CGPoint)convertPoint:(CGPoint)point fromView:(UIView *)view;

CGPoint pt = [button converPoint:button.bound.origin toView:self.view];

关于ios - 直接从iOS中的Self.view计算UIButton的起源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20756465/

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