모달 뷰 컨트롤러 (두 번째)에서 모달 뷰 컨트롤러 (첫 번째)를로드하려고합니다. 복잡하게 들리지만 아마 그렇지 않을 수도 있습니다.Modal UIViewController가 나타나지 않습니다.
1 차 컨트롤러는 실제로하는 .m 파일에는 loadView 메소드에서 초기화되는있는 UIWebView입니다 :있는 viewDidLoad에서 다음
- (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;
}
:
- (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로 초기화됩니다.
내가 의도 한 목적은 UIWebView를 "LandscapeCoverController"보기로 감추고 두 번째 모달보기가 닫히게하는 버튼과 대화 형 기능을 제공하는 것입니다.
왜 내 landscapeCoverController가로드되지 않습니까? 어떤 생각이라도 대단히 감사합니다! 또한
... 1 모달보기 컨트롤러처럼 보이는 .H (LandscapeViewController) :
@class LandscapeCoverController;
@interface LandscapeViewController : UIViewController <UIWebViewDelegate> {
UIWebView *myWebView;
LandscapeViewController *landscapeCoverController;
}
@property (nonatomic, retain) UIWebView *myWebView;
@property (nonatomic, retain) LandscapeViewController *landscapeCoverController; // Modal view controller
와 ... 2 모달보기 컨트롤러 (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];
진술 문은 초기화를 처리해야하고 컨트롤러 구성 ...
앱의'mainScreen' 뷰입니까? –
@sudo rm -rf (멋진 이름) mainScreen은 화면의 경계를 나타내는 UIScreen 객체를 반환하는 UIScreen의 클래스 메서드입니다. – Jumhyn