0
이것이 작동하지 않는 이유를 알 수 없습니다. 나는 스크린 주위에 블록의 행/열을 스크롤하는 것을 포함하는 게임을 쓰고있다. Portrait에 엄격하게 제한된 오리엔테이션이 있지만 그렇게 행동하지는 않습니다.부적절한 iPhone 방향?
아래의 방법을 호출하면 팬에서 속도가 전달됩니다. 로그를 사용하여 내 방향을 세로로 지원하는 것처럼 내 장치를 거꾸로 잡고 좌우로 움직이는 동작을 볼 수있었습니다. Portrait 만 제외하고 어떻게 할 수 있습니까?
다음은 내가하고 싶은 일을 설명하고 내 마음을 바르게 정당화하는 데 도움이되는 몇 가지 코드입니다.
bool horizontalPan = (fabs(velocity.x) >= (fabs(velocity.y)));
if (horizontalPan)
{
if (fabs(velocity.x) > MAX_VELOCITY)
{
if (velocity.x > 0)
velocity = CGPointMake(MAX_VELOCITY, 0);
else
velocity = CGPointMake(-MAX_VELOCITY, 0);
}
else
{
velocity = CGPointMake(velocity.x, 0);
}
velocity = ccpMult(velocity, PAN_SENSITIVITY);
[self panRow:velocity object:object];
}
else
{
if (fabs(velocity.y) > MAX_VELOCITY)
{
if (velocity.y > 0)
velocity = CGPointMake(0, MAX_VELOCITY);
else
velocity = CGPointMake(0, -MAX_VELOCITY);
}
else
{
velocity = CGPointMake(0, velocity.y);
}
velocity = ccpMult(velocity, PAN_SENSITIVITY);
[self panColumn:velocity object:object];
}
}
- (BOOL) shouldAutorotateToInterfaceOrientation : (UIInterfaceOrientation) interfaceOrientation { \t 반환 UIInterfaceOrientationIsPortrait (interfaceOrientation); } – Clev3r
shouldAutorotate 메소드는 어디에 있어야합니까? – Clev3r