Apple 開発者ポータルから DynamicsCatalog.xcodeproj をダウンロードしただけですが、次のエラーが発生します。
'UIAttachmentBejavior' の目に見える @interface がないため、セレクター initwiitem が宣言されます
この行で:
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;
}
このデモコードを修正する理由や方法を知っている人はいますか?