私はNSArrayに私のtouchesMoved値を保存したいのですが、どうすればそれを保存できますか?今私はタッチを移動する値を格納しようとするが、私は値を印刷されません。ここ は私のコードiPhoneのNSArrayにtouchesMoved値を格納する
- (void)initWithSize:(int)nX height:(int)nY {
xWidth = nX;
yHeight = nY;
xArray = [[NSMutableArray alloc] initWithCapacity:xWidth];
for (int i = 0; i < xWidth; i++) {
yArray = [[NSMutableArray alloc] initWithCapacity:yHeight];
for (int j = 0; j < yHeight; j++) {
}
roomArray = [[NSArray alloc] initWithArray:yArray];
[xArray addObject:roomArray];
[roomArray release];
[yArray release];
}
である私は、この
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
NSString *myArrayString = [xArray description];
NSLog(@"screeX:%@ ",xArray);
}
のように、この値を印刷しますが、私は私のコンソール出力でそのピクセルを取得did'tこの
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
CGPoint currentPoint = [touch locationInView:self];
[self initWithSize:currentPoint.x height:currentPoint.y];
}
のように、このメソッドを呼び出します このように出力されました
screeX:(
(
),
(
),
(
),
(
),
(
),
(
),
(
),
(
urコードごとに、アレイは割り切れたタッチが動かされるたびに割り当てられます。 – vishy
@vishyは配列にその値を格納するために何ができるのですか? –
以下の答えを試してみて、結果を教えてください – vishy