[英]How to Show a PopOver always portrait with different interface orientations?
我已通過此代碼阻止了界面方向。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
if (orientation == UIDeviceOrientationPortrait) {
NSLog(@"portrait");
}else{
NSLog(@"landsape");
}
return NO;
}
我正在使用一個彈出框指向一個按鈕向上的方向。
[popoverController presentPopoverFromRect:[按鈕范圍] inView:允許的按鈕ArrowDirections:UIPopoverArrowDirectionUp動畫:是];
這對於portait模式是正確的。 我的問題是,相對於屏幕的縱向模式,如何始終顯示彈出窗口? 如果有人有任何想法,請幫助...提前表示感謝。
如果您始終想使用縱向模式,而不是用以下方法替換您的方法
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.