これはまったく変わっていません。私は、ウィンドウ、ナビゲーションコントローラ、ビューコントローラ、ウェブビューからなる非常に基本的なアプリケーションを使ってテストを行いました。すべてはプログラムによって作成されます。コードは次のようで、最後に私が変換された矩形を描画しながら、最後に私はすべてのビューフレームをプロットします
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
UIViewController *vc = [[UIViewController alloc] initWithNibName:nil bundle:nil];
UIWebView *wv = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 416)];
[wv loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]];
[vc.view addSubview:wv];
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:vc];
self.window.rootViewController=nc;
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
NSLog(@"W: %@",NSStringFromCGRect(self.window.bounds));
NSLog(@"NC: %@",NSStringFromCGRect(nc.view.frame));
NSLog(@"VC: %@",NSStringFromCGRect(vc.view.frame));
NSLog(@"WV: %@",NSStringFromCGRect(wv.frame));
NSLog(@"WV->WIN: %@",NSStringFromCGRect([wv.superview convertRect:wv.frame toView:nil]));
return YES;
}
結果は以下の通りです:
あなたがた一つです
W: {{0, 0}, {320, 480}}
NC: {{0, 0}, {320, 480}}
VC: {{0, 0}, {320, 416}}
WV: {{0, 0}, {320, 416}}
WV->WIN: {{0, 64}, {320, 416}}
期待している。おそらく、ビューが階層内に配置される方法で何らかの間違いをしていると思われます。たとえば、Interface Builderを使用していますか?そのような場合、ビュー位置に間違った座標を入れなかったことを確認できますか?
私は自分のビューのスーパービューとそのスーパービューをチェックして、スーパービュー(継続しています)を確認すると、最終的にビューに到達する前に私は最終的にnilを見つけました。私の見解はまだ挿入されていませんでした。 – Marc