簡體   English   中英

uipopover框架是否在定位時重置而沒有隱藏或關閉?

[英]Uipopover frame reset on orientation without hiding or dismissing?

在視頻按鈕上顯示彈出窗口:

[self.popOverController presentPopoverFromRect:[self.view convertRect:buttonFrame toView:self.view.window]
                                                inView:self.view.window
                              permittedArrowDirections:UIPopoverArrowDirectionUp
                                              animated:YES];

videoButton是一個按鈕,從中彈出彈出窗口。 現在的問題是,當我旋轉設備時,彈出窗口保持在繪制位置,而視圖的其余部分根據旋轉進行調整。 簡而言之,當設備在繪制了彈出框的情況下旋轉時(從UIButton彈出),彈出框不會隨UIButton一起移動。 如果我關閉彈窗並再次從按鈕上繪制它,它將正確地繪制在按鈕上方。 僅在彈出彈出窗口時旋轉才出現問題。

關於方向,我想更改框架位置,而不是取消並重新顯示。 我怎么能這樣呢?

您可以再次調用當前的popover方法將改變方向的方法。

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {

    [super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];

    [self.popOverController presentPopoverFromRect:[self.view convertRect:buttonFrame toView:self.view.window] inView:self.view.window permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM