简体   繁体   中英

Changing UIToolbar UIBarMetrics

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.

I think you need

UIToolbar *toolbar = [UIToolbar appearance];

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

You can simple to setBarMetrics to UIBarMetricsLandscapePhone

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM