だから私はこのようなUIImageView
のNSMutableArray
を作成:center.xとcenter.yにuiimageviewsの配列がありますか?
NSMutableArray* imageViewArray = [[NSMutableArray alloc] init];
for(int i = 0; i < 15; i++){
UIImageView* imageView = [self animationInit:imageArray xPos:0 yPos:480 wFrame:32
hFrame:32 duration:0.5 repeat:0];
[imageViewArray addObject:imageView];
[imageView release];
imageView = nil;
[self.view addSubview:[imageViewArray objectAtIndex:i]];
}
方法「animationInitは」私はUIImageViewを初期化するために作成する方法です。私はこのように使用して、配列内の各UIImageViewの中心を設定することができる午前
-(UIImageView*)animationInit:(NSArray*)imageArray xPos:(float)x yPos:(float)y wFrame:
(float)w hFrame:(float)h duration:(float)duration repeat:(float)count {
UIImageView* imageAnimation = [[UIImageView alloc] initWithFrame:CGRectMake(x, y, w, h)];
imageAnimation.animationImages = imageArray;
imageAnimation.animationDuration = duration;
imageAnimation.animationRepeatCount = count;
return imageAnimation;
}
:
[imageViewArray objectAtIndex:Index] setCenter:CGPointMake(x, y)];
今、私はx
とy
を変更することはできませんしたいと思い、その実装はこれです私は通常のUIImageView
と思っています。例:
ここでの問題は、UIImageViews
の配列内の "UIImageView.center.x/y"にアクセスする方法がわかりません。私が "setCenter:"とできるように "center.x/y"にアクセスする方法はありますか?の中のx
とy
を保持するためにCGPoints
の束を作る方が良いでしょうか?
私が[imageViewArray objectAtInded:Index].center.x
を試すと、次のエラーが発生します。
Request for member 'center' in something no a structure or union
解決策または回避策はありますか?
あなたはできる、アレイ内の画像ビューをループし、その中央プロパティを変更します。あなたはそれで何が問題になっていますか? – EmptyStack
申し訳ありません私は私がしたいことを説明することでそれほど良くはないと思います。[[imageViewArray objectAtIndex:Index] setCenter:CGPointMake([imageViewArray objectAtIndex:Index] .x + 5、[imageViewArray objectAtIndex:Index] y + 5])];しかし、明らかにこれは私がそれを書いた方法では不可能です。これは今より意味をなさないでしょうか? – RickyTheCoder
あなたはそれをそうすることができますか?なぜそれは不可能だと言いますか? – EmptyStack