【发布时间】:2013-11-13 21:20:56
【问题描述】:
我有以下代码,它只是将密码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];
【问题讨论】:
-
什么都没有发生?它编译,不是吗?你认为应该发生什么?结果行为与您的预期有何不同?
-
你没有解释你真正想要做什么,你能补充一下吗?
标签: ios objective-c ios7 cgpoint uidynamicbehavior