2009-11-28 5 views
0

가 나는 UIViewController에의 UIView는

Notepad *notepad = [[Notepad alloc] initForNewTopLevelTask:0 andDAO:self.dao]; 

[self.navigationController pushViewController:notepad animated:YES]; 
[notepad release]; 

initForNewTopLevelTask에 다음 코드가있는 회전하지 않습니다. UIViewController 행을 다음과 같이 변경하면

Notepad *notepad = [[Notepad alloc] init]; 

잘 돌아갑니다!

보기는 탭 컨트롤러의 일부가 아닌 내가 구현 한 : 당신은 항상 당신의 자신의 초기화 방법에서 부모 클래스의 init 메소드를 호출한다

// Override to allow orientations other than the default portrait orientation. 
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    // Return YES for supported orientations 
    return YES; 
} 

답변

1

. 어떤 시점에서 NSObject에서 확장되는 모든 객체에 대해 최소한.

http://developer.apple.com/iphone/library/documentation/cocoa/Conceptual/ObjectiveC/Articles/ocAllocInit.html#//apple_ref/doc/uid/TP30001163-CH22-SW4

가 당신의 init 함수 변경을 참조하십시오 :

- (id) initForNewTopLevelTask:(int) theTableSize andDAO:(DAO*) aDAO { 
    if (self = [super init]) { 
    self.dao = aDAO; 
    tableSize = [[NSNumber alloc] initWithInt:theTableSize]; 
    self.isNew = [NSNumber numberWithBool:YES]; 
    self.isSubtask =[NSNumber numberWithBool:NO]; 
    } 
    return self; 
} 
+0

너무 너무 너무 감사합니다! –

관련 문제