0

I have problems with displaying view as subview on navigationController.view on Ipad . I need to display view with transparent background on my viewController(with navBar),but while i change orientation my navBar become visible on foreGround of my view; I created simple view based app. Here code i added to project:

AppDelegate.h:

 UINavigationController *_navController;

@property (strong, nonatomic) UINavigationController *navController;

AppDelegate.m:

_navController = [[[UINavigationController alloc] initWithRootViewController:self.viewController] autorelease];
    self.window.rootViewController = _navController;

ViewController.m:

- (void)viewDidLoad
{
    [super viewDidLoad];
    UIView *view = [[[UIView alloc] initWithFrame:self.view.frame] autorelease];
    [view setBackgroundColor:[UIColor redColor]];

    [self.navigationController.view addSubview:view];
}
Ncit
  • 9
  • 2

1 Answers1

2

try pushing view to Navigation Controller

 YourAppDelegate *del = (YourAppDelegate *)[UIApplication sharedApplication].delegate;
[del.navigationController pushViewController:nextViewController animated:YES];

or

UINavigationController* navigation = [[UINavigationController alloc] init];
 iVkViewController *overviewViewController = [[iVkViewController alloc] init];
 overviewViewController.title = @"First";
 [navigation pushViewController:overviewViewController animated:NO];
iMeMyself
  • 1,649
  • 13
  • 28
  • I do not have viewController. I need to display custom view above navController and navBar.I need fully cover display,cos when i pushViewController i push my view under the navBar. – Ncit Jul 26 '12 at 07:36
  • okay so you want a custom bar ?have you tried tool bar? these lines may help u ..try along with uiview... UINavigationController *navCon = [[UINavigationController alloc] initWithRootViewController:self.viewController]; [navCon setNavigationBarHidden:YES]; self.window.backgroundColor = [UIColor clearColor]; – iMeMyself Jul 26 '12 at 09:19
  • No. I have an app with navigationBar. I need to create UIView with transparent background,which will be added to viewController as subView. I need to do this all because i need to see elements from my viewController. Everything working fine until i rotate device. While rotation navBar become visible. I need hole screen to be under my view. – Ncit Jul 26 '12 at 09:31
  • is your app orientation change set? check this link http://stackoverflow.com/questions/7779619/ipad-orientation-checking-uiview-class – iMeMyself Jul 26 '12 at 09:58
  • Support of all orientations. I created project with single view. All code i added to it , is represented above in first my question. – Ncit Jul 26 '12 at 11:23