Nik*_*k's 6 iphone xcode cocoa-touch objective-c
嗨,我试图存储移动点,NSMutableArray所以我尝试这样
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *move = [[event allTouches] anyObject];
    CGPoint MovePoint = [move locationInView:self.view];
if (MovePointsArray==NULL) {
        MovePointsArray=[[NSMutableArray alloc]init];
    }
    [MovePointsArray arrayWithObjects:[NSValue valueWithCGPoint:MovePoint]];
}
但这不起作用我如何存储这些点 NSMutableArray
jus*_*mer 17
你应该在最后一行使用addObject:
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *move = [[event allTouches] anyObject];
    CGPoint MovePoint = [move locationInView:self.view];
if (MovePointsArray==NULL) {
        MovePointsArray=[[NSMutableArray alloc]init];
    }
    [MovePointsArray addObject:[NSValue valueWithCGPoint:MovePoint]];
}
| 归档时间: | 
 | 
| 查看次数: | 4378 次 | 
| 最近记录: |