开发者

Popover resizing erraticly

开发者 https://www.devze.com 2023-01-26 14:48 出处:网络
I have a UITabBarController inside a UIPopoverController, which I am displaying solely from one UIBarButtonItem. When shown I want the popover to take up the maximum vertical height allowed. It works

I have a UITabBarController inside a UIPopoverController, which I am displaying solely from one UIBarButtonItem. When shown I want the popover to take up the maximum vertical height allowed. It works fine if I tap to display it, then dismiss, and then rotate. However if I have the popover displayed in landscape, and then rotate to portrait, it no longer will fill the entire vertical distance. I have the tab bar controller's content size property set to 320 by 1000, and I have even tried resetting this every time the device rotates. Worse yet, when the user activates the search bar the popover shrinks up extremely small, and stays that way until the app is restarted.

http://cl.ly/3JdC to http://cl.ly/3JdC

Also http://cl.ly/3JV开发者_如何学运维F

How can I stop this, and have the popover always fill up the max vertical size?


I was just having the same problem and found out that it only happens when I present the UIPopoverController using the method:

- (void)presentPopoverFromBarButtonItem:(UIBarButtonItem *)item permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated

but it works fine when I use:

- (void)presentPopoverFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated

Unfortunately UIBarButtonItem does not have a frame Rect you can use with this last method so my fix was to use the UIToolbar's frame and modify frame.origin.x and frame.size.width accordingly to make the popover appear on the right place next to the UIBarButtonItem.

Hopefully Apple will fix this in next releases of iOS.

Regards

0

精彩评论

暂无评论...
验证码 换一张
取 消