モーダルビューコントローラ(第2)からモーダルビューコントローラ(第1)をロードしようとしています。それは複雑に聞こえるが、おそらくそうではない。モーダルUIViewControllerが表示されません
第一コントローラは、実際に.mファイルのloadViewメソッドで初期化されるのUIWebViewである:
- (void)loadView {
// Initialize webview and add as a subview to LandscapeController's view
myWebView = [[[UIWebView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]] autorelease];
//CGRect forceframe = CGRectMake(0, 0, 480, 320);
//myWebView = [[[UIWebView alloc] initWithFrame:forceframe] autorelease];
myWebView.scalesPageToFit = YES;
myWebView.autoresizesSubviews = YES;
myWebView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
myWebView.delegate = self;
self.view = myWebView;
}
その後のviewDidLoadで:
- (void)viewDidLoad {
[super viewDidLoad];
// Load HTML file as an NSURL request
[self.myWebView loadHTMLString:updated_html baseURL:nil];
// Invoke the covering modal view on condition
if (some_condition) {
landscapeCoverController = [[UIViewController alloc] initWithNibName:@"LandscapeCoverController" bundle:[NSBundle mainBundle]];
[self presentModalViewController:landscapeCoverController animated:YES];
[landscapeCoverController release];
}
ザ・第2回モーダルビューコントローラ(landscapeCoverControllerを意図しました)はIBで設定したNIBで初期化されます。
私の意図する目的は、「LandscapeCoverController」ビューでUIWebViewを条件付きで隠蔽することです。このビューには、2つ目のモーダルビューが表示されなくなるいくつかのボタンと対話性があります。
なぜ私のlandscapeCoverControllerがロードされていませんか?どのような考えが大いに感謝!
また...第一モーダルビューコントローラ(LandscapeViewControllerが)のように見えます.H:
@class LandscapeCoverController;
@interface LandscapeViewController : UIViewController <UIWebViewDelegate> {
UIWebView *myWebView;
LandscapeViewController *landscapeCoverController;
}
@property (nonatomic, retain) UIWebView *myWebView;
@property (nonatomic, retain) LandscapeViewController *landscapeCoverController; // Modal view controller
と...第二モーダルビューコントローラ(landscapeCoverController)のviewDidLoadは何もしません:
// NIB initialized in LandscapeViewController.m viewDidLoad:
- (void)viewDidLoad {
[super viewDidLoad];
}
私が思うように
landscapeCoverController = [[UIViewController alloc] initWithNibName:@"LandscapeCoverController" bundle:[NSBundle mainBundle]];
[self presentModalViewController:landscapeCoverController animated:YES];
[landscapeCoverController release];
ステートメントは初期化とloを処理する必要がありますコントローラの作成...
'mainScreen'はあなたのアプリのビューですか? –
@sudo rm -rf(nice name)mainScreenは、画面の境界を表すUIScreenオブジェクトを返すUIScreenのクラスメソッドです。 – Jumhyn