非常に単純なビューを表示するのに苦労しています。このビューには、切り替えビュー コントローラーによって管理されるカスタム ビュー コントローラーがあります。XIB には、Image プロパティが設定された 1 つの UIViewController コンポーネントがあります。ビューコントローラーは次のとおりです。
InstructionsViewController.h
#import <UIKit/UIKit.h>
@interface InstructionsViewController : UIViewController {
}
@end
InstructionsViewController.m
#import "InstructionsViewController.h"
@implementation InstructionsViewController
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
// Release anything that's not essential, such as cached data
}
- (void)dealloc {
[super dealloc];
}
@end
また、XIB の File's Owner のクラス プロパティを InstructionsViewController に設定し、Ctrl+Dragged File's Owner を View アイコンに設定し、ポップアップ メニューから View を選択しました。
ビューを表示するコードは次のとおりです。
- (void) showInstructions
{
//Lazy load the instruction view.
if (self.instructionsViewController == nil)
{
InstructionsViewController *viewController = [[InstructionsViewController alloc]
initWithNibName:@"InstructionsView"
bundle:nil];
self.instructionsViewController = viewController;
[viewController release];
}
[self.view insertSubview:viewController.view atIndex:0];
}
切り替え時に異なるビューをアニメーション化するビュー コントローラーは、他の 3 つのビューの読み込みと表示に問題はありません。これが気に入らないだけです。
簡単なことを見逃していると確信していますが、私の人生では、何らかの理由でそれを機能させることができません。誰にも指針がありますか?
ありがとう、
スティーブ