gpt4 book ai didi

ios - UIAttachment 在 iOS 7 中不起作用

转载 作者:行者123 更新时间:2023-11-29 03:29:48 25 4
gpt4 key购买 nike

我有以下代码,它只是将密码 UITextField 附加到 anchorPoint。当我运行这个时,什么也没有发生。

UIDynamicItemBehavior *behavior = 
[[UIDynamicItemBehavior alloc] initWithItems:@[passwordTextField]];

CGPoint anchor = passwordTextField.center;
anchor.y -= 200;

_attachment = [[UIAttachmentBehavior alloc] initWithItem:passwordTextField
attachedToAnchor:anchor];

_gravity = [[UIGravityBehavior alloc] initWithItems:@[passwordTextField]];
_gravity.magnitude = 10;

[behavior addChildBehavior:_gravity];
[behavior addChildBehavior:_attachment];

[_animator addBehavior:behavior];

最佳答案

附件不会改变项目的位置。相反,它只会使项目和附着点之间的距离固定。

如果您想修改距离,请尝试使用 UISnapBehavior。

关于ios - UIAttachment 在 iOS 7 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19964605/

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