0

I am having problems adjusting the size of the UINavigationController on iPad (iOS 4.3.5). On the tablet's large screen it appears as a window with the background of fullscreen view dimmed, however I want to adjust the width of that window (to be the same size as iPhone Retina display).

SettingsViewController *settingsController = [[SettingsViewController alloc] init];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:settingsController];

[self presentModalViewController:navController animated:YES];

SettingsViewController contains a UITableView and with the default width of the UINavigationController window it looks too wide, so I need to either make the window narrower or at least add some padding to the underlying UITableView, so that the rows are not as wide.

Any solutions/suggestions would be appreciated.

Mike Gouline
  • 187
  • 2
  • 11
  • DONOT present the navigationController as a modalviewcontroller. Bad things will happen. Call [window addSubview:self.navController.view]; – CodaFi Oct 18 '11 at 04:13
  • That would make the view appear fullscreen - I want it to be displayed in a window (on iPad) – Mike Gouline Oct 18 '11 at 04:38

1 Answers1

6

Found it in another thread How to resize a UIModalPresentationFormSheet?.

I just needed to set the modalPresentationStyle on the navController to UIModalPresentationFormSheet and after presenting it, modify the superview frame size and center.

SettingsViewController *settingsController = [[SettingsViewController alloc] init];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:settingsController];
navController.modalPresentationStyle = UIModalPresentationFormSheet;

[self presentModalViewController:navController animated:YES];

navController.view.superview.frame = CGRectMake(0, 0, 200, 200);
navController.view.superview.center = self.view.center;
Community
  • 1
  • 1
Mike Gouline
  • 187
  • 2
  • 11