碰撞行为边界未得到尊重

时间:2014-07-10 22:45:46

标签: ios cocoa-touch collision-detection

使用“跳出效果”UIView

在导航栏下方显示self.dropDownBar

尽管设置了边界,但UIView继续从屏幕底部掉落

点击此处https://developer.apple.com/library/ios/documentation/uikit/reference/UICollisionBehavior_Class/Reference/Reference.html#//apple_ref/occ/instm/UICollisionBehavior/addBoundaryWithIdentifier:fromPoint:toPoint

表明:

addBoundaryWithIdentifier:fromPoint:尖山: P1 边界线段的起点。 P2 边界线段的终点。似乎是这样做的,

Collision not working between items(没有接受的答案,没有合适的)

.h
<UICollisionBehaviorDelegate>
@property (strong, nonatomic) UIDynamicAnimator *animator;


.m
self.animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view];

    UIGravityBehavior* gravityBehavior =
    [[UIGravityBehavior alloc] initWithItems:@[self.dropDownBar]];
    [self.animator addBehavior:gravityBehavior];

    UICollisionBehavior* collisionBehavior =
    [[UICollisionBehavior alloc] initWithItems:@[self.dropDownBar]];



    //To - from boundries
    [collisionBehavior addBoundaryWithIdentifier:@"NotificationBoundary" fromPoint:CGPointMake(0, 45)
                                                                         toPoint:CGPointMake(0, 90)];

    [self.animator addBehavior:collisionBehavior];

我在这里缺少什么?

0 个答案:

没有答案