1

我在我的 iPad 应用程序中使用 UIPopover,但是当我使用 IBAction 从此 UIPopover 调用视图时遇到问题,该视图打开但没有旋转,我可以看到预览视图在 UIPOPover 仍然打开的情况下旋转。

我在调试器控制台上遇到的错误:

2011-06-18 16:34:49.562 UniversityAlumni[8540:207] 视图控制器从 -shouldAutorotateToInterfaceOrientation 返回 NO:对于所有界面方向。它应该支持至少一个方向。wait_fences:未能收到回复:10004003

这是我用来打开 UIPOPOver 的 IBAction :

-(IBAction)barBtn3:(id)sender
{
    if (self.popoverController3 == nil) {
        PopOverSelfMain *selfserve = 
        [[PopOverSelfMain alloc] 
         initWithNibName:@"PopOverSelfMain" 
         bundle:[NSBundle mainBundle]]; 

    UIPopoverController *popover3 = 
    [[UIPopoverController alloc] initWithContentViewController:selfserve]; 

    popover3.delegate = self;
    [popover3 setPopoverContentSize:CGSizeMake(220, 220)];
    [selfserve release];

    self.popoverController3 = popover3;

    [popover3 release];
}


CGRect popover3Rect = [self.view convertRect:[btn3 frame] fromView:[btn3 superview]];

[self.popoverController3 presentPopoverFromRect:popover3Rect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];

}

然后在 POPOver 里面我使用这个方法打开一个新视图:

-(IBAction)actionevent:(id)sender{
Eventspage *listing = [[Eventspage alloc] initWithNibName:nil bundle:nil];
listing.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:listing animated:YES];
[listing release];

}

我是第一次使用 POPOver 并且我遗漏了一些东西……dismissPopover 可以解决这个问题吗?或者我应该使用其他方法来调用 View 吗?

4

1 回答 1

0

这里不是调用“presentModalViewController”方法,而是直接使用 NSTimer 调用它,您的问题将得到解决。我在我的项目中解决了这个问题,因为我遇到了同样的问题。

所以,你可以在你的项目中这样做。

-(IBAction)actionevent:(id)sender{

[NSTimer scheduledTimerWithTimeInterval:0.001 target:self selector:@selector(open_EventPage) userInfo:nil repeats:NO];

}

-(void) open_EventPage { Eventspage *listing = [[Eventspage alloc] initWithNibName:nil bundle:nil]; Listing.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; [self presentModalViewController:listing animated:YES]; 【上市发布】;}

让我知道您是否可以在这里解决问题。

于 2011-07-03T12:50:06.427 回答