私はプログラミングにはあまり新しく、私は(単純な)アプリを作りましたが、画面上に画像を描画する方法(ユーザーが画像を描画する方法)を知りたいその画像を使用してゲームを左右に動かすだけで(そして別の画像と衝突しているかどうかを確認する)目的のCでiPhoneに描画する
...私は
float pointx;
float pointy;
- (void)drawRect:(CGRect)rect {
CGColorRef blue = [[UIColor blueColor] CGColor];
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextClearRect(context, self.bounds);
CGContextSetFillColorWithColor(context, blue);
CGContextFillRect(context, CGRectMake(pointx, pointy, 10, 10));
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch=[[event allTouches]anyObject];
CGPoint point = [touch locationInView:touch.view];
pointx = point.x;
pointy = point.y;
[self setNeedsDisplay];
}
。これを持っているが、私は青い四角が指に入る、画面上を押したときに、しかし、会費は何も描画しませ
あなたはユーザーが画面上で指を動かすと画像が見えますか? – booleanBoy
yeah ........... – miniman