-2

iPhone画面全体(ナビゲーションタブバーも)にオーバーレイ画像を配置しようとしていますviewDidLoadが、何も起こりません。

self.imageView = [[UIImageView alloc]
                              initWithImage:[UIImage imageNamed:@"overlayimage.png"]];
UIWindow* window = [[UIApplication sharedApplication] keyWindow];
    [window.rootViewController.view addSubview: imageView];

UITapGestureRecognizer * recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
    recognizer.delegate = self;
    [imageView addGestureRecognizer:recognizer];
    imageView.userInteractionEnabled =  YES;
    self.imageView = imageView;

これは私が取得しようとしている結果です: ここに画像の説明を入力

4

2 に答える 2

4

UIWindowは のサブクラスであるためUIView、キー ウィンドウにサブビューを追加することもできます。
これらのサブビューは、View Controller の上に表示されます。

UIWindow *keyWindow = [[[UIApplication sharedApplication] delegate] window];
[keyWindow addSubview:imageView];
于 2013-08-30T11:51:31.557 に答える
0
imageView.frame = [[UIScreen mainScreen] applicationFrame];
[self.navigationController.view addSubview: imageView];
于 2013-08-30T11:16:27.903 に答える