두 번 이상 회전하면 응용 프로그램이 충돌합니다. 처음에는 아이폰 시뮬레이터라고 생각했기 때문에, 아이팟 터치에 앱을로드했고, 회전 수가 줄어들면서 추락했습니다. 내 회전 방법 중 하나에서 메모리 누수가 의심됩니다. 충돌이 발생했다고 생각할 수있는 유일한 곳은 willRotateToInterfaceOrientation:duration:
입니다. 추가/확장 된 회전과 관련된 두 가지 방법은 shouldAutorotateToInterfaceOrientation:
및 willRotateToInterfaceOrientation:duration
이며 두 단어 만 포함되어 있기 때문에 첫 번째 방법이라고 생각하지 않습니다. return YES;
. 여기 내 willRotateToInterfaceOrientation:duration:
메서드가 있으므로 검토하여 가능한 메모리 누수가있는 곳을 확인할 수 있습니다.여러 번 회전하면 내 응용 프로그램이 충돌합니다.
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration
{
UIFont *theFont;
if ((orientation == UIInterfaceOrientationLandscapeLeft) || (orientation == UIInterfaceOrientationLandscapeRight))
{
theFont = [yearByYear.font fontWithSize:16.0];
yearByYear.font = theFont;
[theview setContentSize:CGSizeMake(460.0f, 635.0f)];
}
else
{
theFont = [yearByYear.font fontWithSize:10.0];
yearByYear.font = theFont;
[theview setContentSize:CGSizeMake(300.0f, 460.0f)];
}
[theFont release];
}
yearByYear은 UITextView
이고 theview는 UIScrollView
이다.
크래시는 일반적으로 누출이 아닌 과도한 객체입니다. 누출은 메모리를 채우는 데 오랜 시간이 걸리며 (홍수가 아닌 한) 먼저 메모리 경고를받습니다. – progrmr