2

Is there anyway to have the UIBarMetrics of a custom UIToolbar change when the device is rotated? I would prefer it happen automatically but if there is something I can do during rotation that would also be ok. I would like to use UIAppearance so manually adjusting the height of the bar won't work.

drewag
  • 93,393
  • 28
  • 139
  • 128

1 Answers1

0

I think you need

UIToolbar *toolbar = [UIToolbar appearance];

[toolbar setBackgroundImage:[UIImage imageNamed:@"toolbarLandscapePhone"] forToolbarPosition:UIToolbarPositionBottom barMetrics:UIBarMetricsLandscapePhone];

You can simple to setBarMetrics to UIBarMetricsLandscapePhone

Community
  • 1
  • 1
dwu
  • 78
  • 1
  • 4
  • Yes, I am setting the background image for UIBarMetricsLandscapePhone but the bar is not changing when I rotate it. It only changes if I use the toolbar from a UINavigationController. The UINavigationController must be doing something with the UIBarMetrics that is not happening automatically with a stand-alone toolbar. – drewag Jan 27 '13 at 06:01