このアクションが実行されると、それはツールバーサブビューは、サブビュー
- (void)displayviewsAction:(id)sender
{
self.view = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]autorelease];
self.view.frame = CGRectMake(0, 0, 320, 480);
[self.view addSubview:toolbar];
UIView *viewController = [[UIView alloc] init];
UIView *secondController = [[UIView alloc] init];
[self.view insertSubview:viewController atIndex:1];
[self.view insertSubview:secondController atIndex:2];
NSLog(@"%d", [[self.view subviews] indexOfObject:viewController]); // Is 1
NSLog(@"%d", [[self.view subviews] indexOfObject:secondController]); // Is 2
[self.view bringSubviewToFront:viewController];
NSLog(@"%d", [[self.view subviews] indexOfObject:viewController]);
[self.view sendSubviewToBack:viewController];
NSLog(@"%d", [[self.view subviews] indexOfObject:viewController]);
[self.view bringSubviewToFront:secondController];
NSLog(@"%d", [[self.view subviews] indexOfObject:secondController]);
SecondViewController * secondController = [[[SecondViewController alloc] init]autorelease];
secondController.view.frame = CGRectMake(0, 0, 320, 480);
[self.view addSubview:secondController.view];
[self.view addSubview:toolbar];
}
と完全に黒のビュー画面に表示、ツールバーのように完全に黒表示されている理由を任意のアイデアを表示するが表示されません。
あなたのコードはメモリ管理の観点から奇妙に思えますが、明らかにARCを使用していません。とにかく、あなたは何が起こっているかを見ることができるように、このビューの内容または少なくとも背景色をどこで定義しますか?フレームを設定することも必須です。実際、このコードは 'ツールバーで完全に黒色'を生成します。 –
私はツールバーを削除しようとしましたが、削除した後は完全に黒い画面が表示されません。 – user1120133
これで両方のビューのフレームが設定されましたが、まだ黒く表示されました。これらのビューの内容は個々のUIViewcontrollersに格納されます – user1120133