didSelectRowAtIndexPath를 사용하여 tableView에서 viewController를 푸시하면 iOS 4.3에서 충돌이 발생하지만 iOS 5.0 이상에서는 정상적으로 작동하는지 파악하려고합니다. 내가 전화 할 때Object dealloc은 iOS 4.3에서만 충돌합니다.
그것은 바로 충돌 :
self.customViewController = [[[CustomViewController alloc] initWithNibName:@"CustomViewController"bundle:nil] autorelease];
언제 처음 후에 customViewController이 추진되고있다.
@property (nonatomic, retain) CustomViewController *customViewController;
-(void) dealloc // Dealloc of tableView.
{
[customViewController release];
customViewController = nil;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
self.customViewController = [[[CustomViewController alloc] initWithNibName:@"CustomViewController"bundle:nil] autorelease]; // Release old, allocate new, set it.
[[self navigationController] pushViewController:customViewController animated:YES];
[customViewController release]; // Balance out pushViewController's retain.
}
감사 :
여기 내 관련 코드입니다.
심각하게 기다리시겠습니까? viewController를 유지한다고 생각했지만 실제로 뷰를 유지한다고 생각하십니까? –
@JoeRaythein보기 컨트롤러를 유지하지만 해제합니다. 그것의 소유권이 필요합니다.autorelease를 호출했을 때 이미 소유권을 포기했습니다. –
하지만'release'는 컨트롤러가 눌려 질 때 앱을 충돌시키지 않아야한다고 생각합니다.'didSelectRowAtIndexPath'가 아닌'dealloc' 메쏘드에서 오류를 일으킬 것입니다. – Ecarrion