다음 코드가 왜 아래 숫자에 해당하는지 이해하는 데 어려움이 있습니다. 누구든지 float에서 int 로의 변환을 설명 할 수 있습니까? 코드를 가정하면, 그렇지 않으면 올바른float에서 int 로의 변환이 이상하게 보입니다.
counter = 0;
pathCells[counter][0].x = pCLocation.x;
pathCells[counter][0].y = pCLocation.y;
cellCount[counter]++;
NSLog(@"%@",[NSString stringWithFormat:@"pCLocation at:
%f,%f",pCLocation.x,pCLocation.y]);
NSLog(@"%@",[NSString stringWithFormat:@"path cell 0: %i,%i",
pathCells[counter][cellCount[counter-1]].x,pathCells[counter][cellCount[counter]].y]);
2012-03-09 01:17:37.165 50LevelsBeta1[1704:207] pCLocation at: 47.000000,16.000000
2012-03-09 01:17:37.172 50LevelsBeta1[1704:207] path cell 0: 0,1078427648
'pathCells'의 유형은 무엇입니까? –
시도해 보셨습니까? NSLog (@ "% @", [NSString stringWithFormat : @ "경로 셀 0 : % i, % i", pathCells [counter] [0] .x, pathCells [counter] [0]. 와이]); 무엇이 인쇄됩니까? – Mrunal
어디서든 NSLog (@ "% @", [NSString stringWithFormat : XXX, a, b, c]);를 쓸 수 있으며, NSLog (XXX, a, b, c)로 대체 할 수 있습니다. '. – benzado