开发者

touchesMoved not registering location

Touchesmoved is not picking up the location of my cursor.

I have this code:

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
    CGPoint touchPoint = [[touches anyObject] locationInView:svEditView];
    [((UIView *)[[svButtonsArray objectAtIndex:svTouchDownID] objectAtIndex:1]) setCenter:touchPoint];
    NSLog(@"Touches moved");
    NSLog(@"1. %i", touchPoint.x);
    NSLog(@"2. %i", touchPoint.y);
}

So the UIView which it's told to drag around does move to the correct location, but on the NSLog it returns 0 every time, for the touchPoint. Any ideas why?

EDIT: Changing it to %f works, but it is a full number with a big trail of .000000 on the end, so not sure why it wouldn't work with开发者_运维百科 %i.


touchePoint.x and .y are float not int. You need to print with %f.

List output that you are getting with %f.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜