この問題があるアップルのサンプルコード「DynamicsCatalog.xcodeproj」をダウンロードします
- (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;
}
私はこの行を置き換えています:
UIAttachmentBehavior *attachmentBehavior = [[UIAttachmentBehavior alloc] initWithItem:self.square1 attachedToAnchor:squareCenterPoint];
この行で:
UIAttachmentBehavior *attacheMentBehavior = [[UIAttachmentBehavior alloc] initWithItem:self.square1 offsetFromCenter:attachmentPoint attachedToAnchor:squareCenterPoint];
しかし、私はこのエラーが発生しています:
cgpoint aka shot cgpoint を、互換性のないタイプのパラメータ UIOffset 別名別の UIOffset に送信する
私が間違っていること、またはこれを修正する方法を教えていただければ幸いです。
ありがとう