我只是从苹果开发者门户下载 DynamicsCatalog.xcodeproj 但我收到了这个错误:
'UIAttachmentBejavior' 没有可见的@interface 清除选择器 initwititem
在这条线上:
UIAttachmentBehavior *attachmentBehavior = [[UIAttachmentBehavior alloc] initWithItem:self.square1 point:attachmentPoint attachedToAnchor:squareCenterPoint];
在 APLAttachmentsViewController.m
这是该行的上下文:
- (void)viewDidLoad
{
[super viewDidLoad];
UIDynamicAnimator* animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view];
UICollisionBehavior* collisionBehavior = [[UICollisionBehavior alloc] initWithItems:@[self.square1]];
CGPoint squareCenterPoint = CGPointMake(self.square1.center.x, self.square1.center.y - 100.0);
CGPoint attachmentPoint = CGPointMake(-25.0, -25.0);
/*
By default, an attachment behavior uses the center of a view. By using a small offset, we get a more interesting effect which will cause the view to have rotation movement when dragging the attachment.
*/
UIAttachmentBehavior *attachmentBehavior = [[UIAttachmentBehavior alloc] initWithItem:self.square1 point:attachmentPoint attachedToAnchor:squareCenterPoint];
collisionBehavior.translatesReferenceBoundsIntoBoundary = YES;
// Show visually the attachment points
self.redSquare.center = attachmentBehavior.anchorPoint;
self.blueSquare.center = CGPointMake(25.0, 25.0);
[animator addBehavior:attachmentBehavior];
self.animator = animator;
self.attachmentBehavior = attachmentBehavior;
}
你们中的任何人都知道为什么或如何修复此演示代码吗?