При выполнении этого действия отображается полностью черный экран с панелью инструментов
- (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];
}
Любые идеи, почему вид на панели инструментов выглядит полностью черным.