1

하나의 XIB에서 두 개의 뷰를 전환하고 싶지만 UINavigationController를 사용하고 싶지 않습니다. 왜냐하면 발생해야 할 전환이 하나뿐이기 때문에 끔찍한 효과가 있기 때문입니다. 여기 내 코드는 다음과 같습니다 UINavigation push 문제 시뮬레이션?

@class WebViewTwo; 
@interface SecondViewController : UIViewController { 
IBOutlet WebViewTwo *webViewTwo; 
} 

가 지금은 도와주세요

2011-05-12 16:59:59.528 TableView[36627:207] -[WebViewTwo superview]: unrecognized selector sent to instance 0x603b660 
2011-05-12 16:59:59.531 TableView[36627:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[WebViewTwo superview]: unrecognized selector sent to instance 0x603b660' 

오류로 충돌 것 .H

// get the view that's currently showing 
UIView *currentView = self.view; 
// get the the underlying UIWindow, or the view containing the current view view 
UIView *theWindow = [currentView superview]; 

// set up an animation for the transition between the views 
CATransition *animation = [CATransition animation]; 
[animation setDuration:0.5]; 
[animation setType:kCATransitionPush]; 
[animation setSubtype:kCATransitionFromLeft]; 
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; 

[theWindow addSubview:webViewTwo]; 

[[theWindow layer] addAnimation:animation forKey:@"SwitchToView1"]; 

! 감사. 오류가 경향이

답변

1

중 하나 WebViewTwoUIView의 서브 클래스가 아닌하거나 perviously 출시되어 더 이상 UIView의 서브 클래스 인 객체를 가리키는 것이 좋습니다. WebViewTwo을 정의한 헤더 파일을 확인하고 서브 형식으로 추가하기 전에 NSLog(@"%@", webViewTwo);을 추가하기 만하면 해당 형식을 볼 수 있습니다.

희망이 도움이됩니다.

+0

그것은 공개되지 않았으며 출시되지 않았습니다 ... 알았습니다 : ''. 나는 내 WebViewTwo.h에 이것을 가지고있다. @interface WebViewTwo : UIViewController {'... 그것을 어떻게 변경하고 그것을 UIView로 서브 클래스 화 하는가? – iosfreak

+0

농담. 다른 누구라도이 문제가 발생하면 UIView의 IBOutlet을 만들고보기와 연결하여 표시하십시오! – iosfreak