1
我在一個希望切換的XIB中有兩個視圖,但我不想爲此使用UINavigationController,因爲它的效率非常低,因爲只有一個需要發生的轉換。這裏是我的代碼:模擬UINavigation推送問題?
// 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"];
.H
@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'
請幫崩潰了!謝謝。
這不是零,並沒有被釋放......明白了:''。我有這在我的WebViewTwo.h'@interface WebViewTwo:UIViewController {'...我如何改變它並將其子類化爲一個UIView? –
iosfreak
2011-05-27 00:36:45
只是在開玩笑。如果其他人有這個問題,只需創建一個UIView的IBOutlet並將其與您的視圖連接並顯示它! – iosfreak 2011-05-27 00:42:29